How to pack structures on word boundaries

Der Herr Hofrat der.herr@mail.hofr.at
Wed Sep 11 13:07:00 GMT 2002


> Hi :
>    I am using the gcc compiler. If I use -fpack-struct option to
> compile my c program, it packs the structure on a byte boundary.
> 
> How can I force gcc to pack on word boundary?
> 
> Is there another option or command for packing on word boundary?
>
use the aligned (NR_BYTES) (or __aligned__ (NR_BYTES) for header files) to 
pass gcc the alignment for an object - see the section "Specfiying Attributes of Types" in the gcc info pages.

hofrat



More information about the Gcc-help mailing list