Mail Archives: djgpp/1998/03/12/13:38:15
> From: G DOT DegliEsposti AT ads DOT it
> Subject: Re: PACKED situation
> > standard problem with PACKED taken from faq.
> >It's a bug in a version of djgpp which according to the faq s been fixed
> >in the djdev201.zip version. The faq says that the structure gets
> >messed up. I get the error below where the ";" is stated as missing.
> >I've been running djdev201.zip derived files for about a year. So
> >version should not be my problem.
> >
> >typedef struct {
> > DWORD style;
> [...]
> > WORD id;
> >} PACKED DLGITEMTEMPLATE; //Error ; missing after struct declaration.
> It seems like you can't do like this if using C++ but only with C!
> Quoting faq 22.9:
>
> However, note that the latter will only work when you compile it as a C
> source; C++ doesn't allow such syntax, and you will have to fall back to
> declaring each struct field with the packed attribute. Therefore, it's
> best
> to only use declarations such as above if you are *certain* it won't be
> ever
> compiled as a C++ source.
>
The following works perfectly with C++ source (You'll get packed
structure)
# pragma pack(1)
struct {
char name[7];
unsigned long offset;
double quality;
};
# pragma pack()
Andris Pavenis
- Raw text -