News for hackers. Stuff that matters.
Re:Perfecting GLFW for Zig, and finding lurking undefined be... by nyanpasu64 on Sunday October 31, 2021 @09:13PM (#29062105)
The (not yet merged) PR 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?

Re:Perfecting GLFW for Zig, and finding lurking undefined be... by ncmncm on Sunday October 31, 2021 @09:30PM (#29062186)
Casting 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.