3 ms·
It would break things. If you have a structure that is part of a network transmission or file format, reordering the fields would read the wrong data. On top of
by AshleysBrain 13y ago
It would break things. If you have a structure that is part of a network transmission or file format, reordering the fields would read the wrong data. On top of that C programmers are used to doing memory hacking type things like taking the address of fields and in some case may need to rely on the certain memory layout of a struct being what they declared it as.
- kristoffer 13y agoYou can't use a struct in a portable way for sending directly on the network or writing/reading to disk. You must always properly serialize the data despite the fact that the _order_ of the elements is defined.