Glfw: Hint value collisions

Created on 21 Jun 2016  路  3Comments  路  Source: glfw/glfw

These defines in glfw3.h have the same values, I believe this is not how it should be, though it won't cause any issues either (afaik).

#define GLFW_NATIVE_CONTEXT_API     0x00036001
#define GLFW_EGL_CONTEXT_API        0x00036002

#define GLFW_ARROW_CURSOR           0x00036001
#define GLFW_IBEAM_CURSOR           0x00036002
bug verified

Most helpful comment

@shurcooL Yes, exactly. It breaks the pattern and loses the ability to disambiguate by value.

Will likely be moving to enums for 4.0.

All 3 comments

Oops. Thank you for spotting this! It likely won't cause any issues, as you say, but it's still wrong.

it's still wrong

Can I ask why you consider it wrong? If those defines are parts of separate namespaces, then overlap in their values is not wrong. Is it?

I agree that using different values might be a good idea because it will help catch potential user errors, where someone could mistakenly use a define for one namespace for a function that expects another, and because there is no type system to catch it, the only other way to catch such a mistake is to avoid reusing same values. Maybe this is what you meant?

@shurcooL Yes, exactly. It breaks the pattern and loses the ability to disambiguate by value.

Will likely be moving to enums for 4.0.

Was this page helpful?
0 / 5 - 0 ratings