News for hackers. Stuff that matters.
Re:The Lost Art of Structure Packing (2018) by Natsu on Monday April 27, 2020 @12:19PM (#22997248)
I'm sort of surprised there are no tools for this. I understand why having the compiler reorder things could be bad, though it seems like there should be room to tell the compiler it's okay to repack it for minimum space, but I don't even see any mention of a source-level tool that would just sort the items in a struct for you.

It seems like something like that could be useful rather than making programmers try to order their structs by hand.

Re:The Lost Art of Structure Packing (2018) by smcameron on Monday April 27, 2020 @02:17PM (#22998393)
Re:The Lost Art of Structure Packing (2018) by SlowRobotAhead on Monday April 27, 2020 @02:05PM (#22998285)
If you just order top down in structures from pointers, 32s, 16s, arrays, 8s, it’s almost entirely done without thinking.

There is almost never a difference to the user what order things are structured. Although to be fair this does get tricky with unions of structure over structure.

Re:The Lost Art of Structure Packing (2018) by Natsu on Tuesday April 28, 2020 @02:54AM (#23004235)
True, but that's the kind of drudgery that's best farmed off to computers. I see that the comment above mentions there is a tool for this that I simply wasn't aware of.