PDA

View Full Version : Attempting to stuff a ull into an int



RandomClown
08-29-2014, 07:21 PM
I found a minor bug while trying to compile in Visual Studio 2012.
It tells me your trying to store an unsigned long long into an integer space.

In the file include/ClanLib/GL/opengl_defines.h : line 1041


GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFull,


An enum is 4 bytes even when compiling for 64bit [at least in VCC].

The code should be instead:


GL_TIMEOUT_IGNORED = 0xFFFFFFFFu,

rombust
08-30-2014, 04:34 PM
GL_TIMEOUT_IGNORED = 0xFFFFFFFFu would be incorrect.

It's used for https://www.opengl.org/sdk/docs/man3/xhtml/glWaitSync.xml ,to specify the 64bit timeout parameter

Since ClanLib 3.1 (development git) requires c++#11, I guess we could use "enum class" for just that one.
or a "const unsigned long long GL_TIMEOUT_IGNORED" global

We try to avoid #defines, since they are not namespace friendly.