GCC requires you to indicate ''packed'' struct variables by using "__attribute__((packed))" in their declaration. Other compilers pack on a per-struct basis according to a pragma setting.
The "PACKED" macro is set to "__attribute__((packed))" when compiling under GCC, and to "" (nothing) when compiling under anything else. That way, you can write "PACKED" after each member of the struct, and it will cause packing under GCC while macro-expanding into nothingness with every other compiler (so there are no errors there).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement