Noted. I new about things like __attribute__ ((unused)), but forgot about mentioned above. My thanks!#pragma pack(1, push)That is M$ C :-)
...
#pragma pack(pop)
For gcc you can use __attribute__((packed))
You also pretty much never, ever, want to 'pack' a structureStraight to the point! That was the reason why I "packed" the things :).
unless you need to match a 'hardware/protocol structure' that
has fields that aren't on their natural boundaries.
Everything that uses a structure has to use the same alignment.And by 'randomly' you mean using the gcc param instead of attribute 'in place'?
So 'randomly' packing system structures will break things.
If you need to make structures portable between architecturesFrankly speaking, the size of the data is relatively small. And byteswapping thing is resolved through the union and byte array, so everything is being sent as a bytearray of known size and then the type casting thing happens based on the header information.
then add explicit padding to ensure 64bit items are on their
natural boundaries (as well as byteswapping as necessary).