| www.delorie.com/archives/browse.cgi | search |
| Xref: | news2.mv.net comp.os.msdos.djgpp:6517 |
| From: | ovek AT arcticnet DOT no (Ove Kåven) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: struct problem |
| Date: | Sat, 27 Jul 1996 12:22:36 GMT |
| Organization: | Vplan Programvare AS |
| Lines: | 20 |
| Message-ID: | <4td989$g13@troll.powertech.no> |
| References: | <4t5kbn$77 AT news DOT charweb DOT org> <4t7jpi$nvl AT news DOT rwth-aachen DOT de> |
| NNTP-Posting-Host: | alwayscold.darkness.arcticnet.no |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
>'__attribute__((packed))' must be appended to *each* member declaration
>of your struct. It's not very intuitive, but that's the way it is. So yours
>should be:
>typedef struct res_hdr {
> char res_sig __attribute__ ((packed));
> int res_numentries __attribute((packed));
>} res_header __attribute__((packed));
I don't think that's necessary... this works fine with me:
typedef struct res_hdr {
char res_sig;
int res_numentries;
} __attribute__((packed)) res_header;
e.g. you apply the attribute to the struct, not the typedef.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |