Cygwin struct alignment

John Emmas johne53@tiscali.co.uk
Mon Dec 29 17:35:00 GMT 2008


----- Original Message ----- 
From: "Brian Ford"
Subject: Re: Cygwin struct alignment
>
> Google attribute packed as I don't remember the exact syntax, but I fail
> to see how this actually helps your cause.
>
Thanks Brian.  It should help me because it will hopefully guarantee that
structures of a given size will occupy a predictable number of bytes.  In
other words, if the total bytes needed to accommodate a given struct's
members is 138, the struct should occupy exactly 138 bytes - instead of
being rounded up to 140 or whatever.

After googling, I think the relevant compiler switch is -fpack-struct.  I'll
give it a try tomorrow but from my initial test (just compiling one source
file) it produced hundreds of warnings of the type:-

ignoring packed attribute on unpacked non-POD field.

This seems to be generated for simple, conventional arrays, such as
char myArray[64];

Is there anything available to suppress this warning?

John 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list