Message-Id: <199803121839.UAA54786@ieva06.lanet.lv> From: "Andris Pavenis" To: djgpp AT delorie DOT com, G DOT DegliEsposti AT ads DOT it Date: Thu, 12 Mar 1998 20:36:49 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: PACKED situation In-reply-to: Precedence: bulk > 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