From: G DOT DegliEsposti AT ads DOT it To: djgpp AT delorie DOT com Message-ID: Date: Thu, 12 Mar 1998 16:59:56 +0100 Subject: Re: PACKED situation Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Precedence: bulk >Hi all, > 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: --- Alternatively, you could declare any single structure to be packed, like so: struct { char name[7]; unsigned long offset; double quality; } __attribute__ ((packed)); 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. --- ciao Giacomo