Struct alignment

Ryan T. Sammartino ryants@home.com
Sat Jun 30 19:30:00 GMT 2001


Well, you can use -fpacked-struct, but that is generally considered a
bad idea ( http://gcc.gnu.org/onlinedocs/gcc-3.0/gcc_3.html#SEC51 ).


You should really consider using __attribute__((packed)).
This is what I use for (e.g.) reading in BMPs and such.

You may want to take a look at
http://gcc.gnu.org/onlinedocs/gcc-3.0/gcc_5.html#SEC100


* Sergio Pires de Albuquerque <sergaobr@yahoo.com> [30/06/2001 08:55]:
> Hi,
> 
> Is there someone who knows if I can disable the "word"
> alignment (4 bytes) of struct members by a compiler
> optionn (GCC 2.95.2 - Solaris 8 - Intel) , not
> __attribute__ keyword? I should read binary files
> created under another environment using no alignment
> at all (WATCOM CC under QNX) so I've been trying to
> figure out.
> 
> 
> Regards,
> 
> 
> =====
> Sergio Pires de Albuquerque
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/

-- 
Ryan T. Sammartino
http://members.home.net/ryants/
Who needs friends when you can sit alone in your room and drink?



More information about the Gcc-help mailing list