This is the mail archive of the gcc-help@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 structures on word boundaries


> 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


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