[lug] OFF: sizeof structs in gcc?

Scott A. Herod herod at interact-tv.com
Thu Jun 7 14:02:17 MDT 2001


Ahhh, I found it.  The info page on gcc says to use pack you must
first #define HANDLE_PRAGMA_PACK_PUSH_POP 1

The windows code that I am porting was sending a class across 
a socket connection.  I confess to having done the same thing
myself in the past, but think that it's pretty evil.  ( Of course
my current code won't work on a big-endian machine talking to a
little-endian. )

The info page has a LOT more information that the man page.  Looks
like there is even a variable `STRUCTURE_SIZE_BOUNDARY'.

Scott

"Holshouser, David" wrote:
> 
> I am using #pragma pack(1) with an old version of gcc (2.7.2 for vxworks on
> a ppc).
> Don't know much about it but that is my setup for the reason as yours.
> 
> > -----Original Message-----
> > From: Scott A. Herod [mailto:herod at interact-tv.com]
> > Subject: [lug] OFF: sizeof structs in gcc?
> >
> > Hello,
> >
> > This is a kind of off topic but I'm hoping to avoid the gcc lists.
> >
> > Is it true that gcc allocates space for objects/stucts in 4 byte
> > words?  Is there a way to avoid this?
> >
> > Looks like winder's VC has a "#pragma pack" that can compact objects
> > but gcc seems to have nothing comparable.  It's not really a problem.
> > That's what bcopy is for.  I'm mainly just curious.
> >
> > Thanks,
> >
> > Scott Herod



More information about the LUG mailing list