4 ms·
The (not yet merged) PR https://github.com/glfw/glfw/pull/1986 https://github.com/glfw/glfw/pull/1986 casts to signed long, which only avoids UB (is 64 bits) on
by nyanpasu64 5y ago
The (not yet merged) PR https://github.com/glfw/glfw/pull/1986 https://github.com/glfw/glfw/pull/1986 casts to signed long, which only avoids UB (is 64 bits) on 64-bit platforms which aren't Windows.
> Wouldn't it be better to cast to unsigned int or something similar (like uint32_t), since long can still be 32 bits? If the size of long and int is the same, wouldn't the cast as proposed in the PR be semantically identical to the current state?
- ncmncm 5y agoCasting to signed long is demonstrably wrong. The code in question is (probably) pretty slow, offering plenty of room for improvement beyond just fixing the UB. But it has seemed to work well enough, so far, like most things.