Re: how to pack data using gcc compiler?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux