This is the mail archive of the gcc-bugs@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]

[Bug c/25274] sizeof(struct) fails for 'unlucky' structure



------- Comment #1 from rguenth at gcc dot gnu dot org  2005-12-06 13:08 -------
The C standard allows for arbitrary padding in between elements, so this
behavior is expected.  Use __attribute__((packed)) on the type to get a struct
without padding if you need that for whatever reason (it will be slower to
access unaligned fields).  You can also sort the fields starting with elements
with
the largest size to minimize required padding.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25274


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