[RFC] Removing -fpack-struct in C++ for 4.0

Andrew Haley aph@redhat.com
Thu Oct 7 13:54:00 GMT 2004


Dave Korn writes:
 > > -----Original Message-----
 > > From: gcc-owner On Behalf Of Giovanni Bajo
 > > Sent: 07 October 2004 12:23
 > > To: Andrew Haley
 > > Cc: gcc
 > > Subject: Re: [RFC] Removing -fpack-struct in C++ for 4.0
 > > 
 > > Andrew Haley wrote:
 > > 
 > > > I'd be interested to see the rationale for including this option in
 > > > the first place.  Is there a link?
 > > 
 > > I tried googling for it but did not succeed. It was probably 
 > > meant only for C, and for freestanding environments.
 > > 
 > > Giovanni Bajo
 > 
 >   Yeh, it's used in embedded code, and it's handy for accessing data structs
 > that may be sent at arbitrary alignment in a stream of network or file data.

You don't need -fpack-stricts for that.  attribute((packed)) will do the job.

Giovanni suggested:

>> the workaround for people doing freestanding C++ is just to use
>> pragma pack everywhere (at the top of a project-wide header, for
>> instance).

Is that not reasonable?

Andrew.



More information about the Gcc mailing list