how to pack data using gcc compiler?

Ian Lance Taylor ian@airs.com
Wed Jan 26 19:48:00 GMT 2005


Michael Sung <mys@cisco.com> writes:

There is no reason to send one e-mail to both gcc-help@gcc.gnu.org and
gcc@gcc.gnu.org.  This message is more appropriate for gcc-help.
Thanks.

> a) What is the default for gcc regarding "pack" or "unpack" data structures?

If I understand your question correctly, the answer is that gcc
normally does not pack data structures.  It normally aligns members of
data structures on their natural alignment, which leads to more
efficient code.

> b) Is there a compiler flag for gcc compiler that will pack all data
> structures?

Yes, -fpack-struct.

Ian



More information about the Gcc-help mailing list