Sergei Sharonov wrote:

Hi,

Packed structures definitely have their use. For example when you
exchange data between different architectures (networks, etc.) Yes, you
take a performance hit in memory access, but in many case you will find
out that it is just a matter if it is you who pack/unpack it manually or
a compiler doing it for you. I agree that sometimes you can play games
with structure member ordering but it is not always up to us to decide
on it (e.g. foreign data).
BTW, I believe default structure packing/ordering is not specified by
any standard (?) - it is "try and see" what the compiler did.

Sergei
The C specs say packing is implementation defined. However, many compilers support "#pragma pack..." to control it

Regards,
Steve


Reply via email to