This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to pack data using gcc compiler?


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]