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.
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.
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.
It seems like something like that could be useful rather than making programmers try to order their structs by hand.