I have a "facade" design pattern for OpenGL calls, which route the calls to their corresponding OpenGL call. I can additionally (but optionally) print out all OpenGL calls and their parameter values, which is useful for debugging. However, for methods which take a GLuint64
parameter (such as glClientWaitSync
), I'm unsure which printf
formatting to use. I'm specifically targeting Windows with MSVC and Linux with GCC and clang.
%lld
works with MSVC, but produces warnings with GCC/clang. (warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 6 has type ‘GLuint64 {aka long unsigned int}
)%lu
works with GCC/clang (in x64_86), but and doesn't cause warnings on MSVC. However, it doesn't print correctly (interpreted as a 32-bit integer).
Am I stuck doing an #ifdef
for the compiler to make the correct format string, or is there a smarter/easier way to do this?
Note: this is not a duplicate of how to print a int64_t
, because GLuint64 is defined as different concrete types at the top of the standard glext.h header.