Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
nuclear's avatar
nuclear
Explorer
11 years ago

Oculus, please keep C++ syntax out of the C SDK.

I recently ported my code to 0.4.4, and I noticed yet another C++-ism in the C headers. While the static_assert you've used is a nice sanity check to make sure structure sizes aren't different from the compiled library, it unfortunately breaks C programs (and really C++ < 11 programs as well). If you must include static_asserts, at the very least put them in a:
#ifdef __cplusplus

or even better an:
#if __cplusplus > 199711L

conditional block.

But really, the most important thing you should do, is have a simple C test program to test with before releasing a new version of the SDK. You can use mine if you like, it's public domain: http://nuclear.mutantstargoat.com/hg/oculus2/file/tip (mercurial repo).

4 Replies

  • Can you give me the filename and line number for one of these asserts?
  • Right, I figured someone would say that. Will check when I'm in the office.
  • I'm hitting a static assert in LibOVR/Src/OVR_CAPI_GL.h line 65:

    ovr_sdk_linux_0.4.4/LibOVR/Src/OVR_CAPI_GL.h:65:14: error: expected constructor, destructor, or type conversion before ‘(’ token
    static_assert(offsetof(ovrGLTextureData, TexId) == offsetof(ovrTexture, PlatformData), "Mismatch of structs that are presumed binary equivalents.");
    ^



    grep static_assert * -rn | wc

    shows 52 other instances in ovr_sdk_linux_0.4.4/.