News for hackers. Stuff that matters.
Re:The C++20 Naughty and Nice List for Game Devs by gumby on Monday December 25, 2023 @11:43AM (#38763965)
> I have yet to see a C++ compiler where the union type punning trick doesn't work

The problem isn’t that compilers won’t implement the feature (that would take more work); the problem is that it’s processor-specific.

The spec doesn’t mandate many specific bit-ordering layouts (some are, such two’s complement representation being mandated which was just added, &obj == &base, I think nullptr has to be 0, etc) rather than trying to make everything a PDP-11.

Re:The C++20 Naughty and Nice List for Game Devs by anonymoushn on Monday December 25, 2023 @12:16PM (#38764282)
In these cases using bit_cast or memcpy will also "break" though :(