News for hackers. Stuff that matters.
Re:The Lost Art of Structure Packing (2018) by TorKlingberg on Monday April 27, 2020 @11:15AM (#22996606)
Yes, the C and C++ standards could have allowed the compiler to reorder structs, but that would have lead to even more of those undefined behavior situation that people complain so much about.

People do quite often rely on the first struct element being at the start of the struct. Memcpy:ing directly between structs and network/disk is also common, but naughty. Both struct padding and endianness already break that.

There are no comments on this comment yet.