Mail Archives: djgpp/1996/05/09/10:09:39
Reply to message 9189285 from MARTYNAS.KUNI on 05/09/96 3:25AM
>Actually, the above will not even compile under G++. The docs say to append
>__attribute__ ((packed)) to the end of every field, not the structure
>declaration. However, your approach works with GNU C, though it is not
>documented. GNU C++ does not accept it. I like your approach ( no extra
>typing ) and I think G++ does not understand it due to a bug. I've reported
>this to gcc bug list.
Considering the large numbers of people who have discovered that
particular G++ bug, I'd be quite surprised if the GNU folks don't have
thousands of bug reports about it.
However, the __attribute__ ((packed)) is indeed completely documented
under DJGPP, under info/gcc/C Extensions/Type Attributes. I quote:
`packed'
This attribute, attached to an `enum', `struct', or `union' type
definition, specified that the minimum required memory be used to
represent the type.
Specifying this attribute for `struct' and `union' types is
equivalent to specifying the `packed' attribute on each of the
structure or union members. Specifying the `-fshort-enums' flag
on the line is equivalent to specifying the `packed' attribute on
all `enum' definitions.
John
- Raw text -