This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: how to pack data using gcc compiler?
- From: James E Wilson <wilson at specifixinc dot com>
- To: Michael Sung <mys at cisco dot com>
- Cc: wdai at cisco dot com, gcc-help at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Wed, 26 Jan 2005 19:51:35 -0800
- Subject: Re: how to pack data using gcc compiler?
- References: <4.3.2.7.2.20050126114025.01c0cf70@mira-sjc5-2.cisco.com>
Michael Sung wrote:
b) Is there a compiler flag for gcc compiler that will pack all data
structures?
But note that this option will pack everything, including structures
defined in system header files, which means your program will no longer
be compatible with your C library unless you also recompile your C
library this way. And then you have to worry about system calls too if
you have any that take structures, which means you might need to
recompile parts of your kernel.
It is almost always wrong to use this option. Better is to use
__attribute__ ((pack)), or #pragma pack, that way you can control what
gets packed.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com