Mail Archives: djgpp/1997/02/26/12:16:30
Olav Kindt <kindt AT cmr DOT no> wrote:-
> ... The faq says that a struct like
> struct {char name[7]; unsigned long offset; double quality;
> } __attribute__ ((packed));
> will be packed correctly when compiled as C-source. Then it says that
> C++ doesn't allow this, and you must declare each struct field with the
> packed attribute. Does this in effect mean this :
> struct {
> char name[7] __attribute__ ((packed));
> unsigned long offset __attribute__ ((packed));
> double quality __attribute__ ((packed)); };
I don't trust the compiler. Best put the `packed' in explicitly before every
`;' inside the { }. Better, save a bit of program size, thus:-
#define pk __attribute__ ((packed))
> struct {char name[7] pk;
> unsigned long offset pk;
> double quality pk; };
- Raw text -