[LCP]struct size

Roberto Diaz rdiazmartin at vivaldi.dhis.org
Sun Aug 19 12:03:52 UTC 2001


> I've run into this before. I had a very large struct; handling each item
> individually was a real pain. Is there any way, with gcc, to force this
> to pack (ie., somestruct be 6 bytes)?  Some attribute when declaring the
> struct or a compiler option to prevent word alignment?

Yes but it is not advisable to pack.. This is a GNU extension and
non-portable. (why was it a pain to handle its items?)

 struct S {} __attribute__ ((packed));


Regards

Roberto

------------------------------------------------------------------------
Roberto Diaz <rdiazmartin at vivaldi.dhis.org>
http://vivaldi.dhis.org
Powered by GNU running on a Linux kernel.
Powered by Debian (The real wonder)

Concerto Grosso Op. 3/8 A minor
Antonio Vivaldi (so... do you need beautiful words?)
------------------------------------------------------------------------




More information about the linuxCprogramming mailing list