Pelles C > Bug reports

pragma pack behavior

(1/2) > >>

Mikehg:
Hi Pelle,

If I use the include files this works fine, but if I use the Pragma directly I get a whole mess of errors? Are the include files the only way to use these directives?

Thanks,
Mike H.

#pragma pack(push,1)


typedef struct _BMP_HEADER
{
   char fIdentity[2];
  long  fFileSize;
  long  fReserved;
  long  fOffset;
  long  fHeaderSize;
  long  fWidth;
  long  fHeight;
  WORD  fPlanes;
  WORD  fBPP;
  long  fCompression;
  long  fDataSize;
  long  fHResolution;
  long  fVResolution;
  long  fColors;
  long  fImpColors;
}BMP_HEADER, *LPBMP_HEADER;

#pragma pack(pop)

Pelle:
Hello Mike,

No, the include files are just for Microsoft compatibility ("convenience").

If I change WORD to (unsigned) short in your example, I have no problems compiling the code. No errors. No problems. (With POCC 2.90 - but I don't think anything have changed in this part recently).

Pelle

Mikehg:
Hi Pelle,

It still seems a little strange that it works if you use the #include instead of the pragma directly? Do you agree?

Thanks again,
Mike H.

Pelle:
Hello Mike,

I agree, but since your example works here, I'm not sure what to do. The #pragma directive is handled by the compiler, after the preprocessor have merged the source file and include files into one big 'file', so it shouldn't matter *where* the #pragma appears. It will only be handled in one place in the compiler...

Pelle

Mikehg:
Hi Pelle, I found the problem and A weird one at that :)

It seems to be a bug that was output by BCX.

At the end of the line containing the pragma, it was adding 2 carriage returns and 1 line feed. PellesC didn't like that all :)

Thanks for your time and of course the terrific work you've done!

Mike H.

Navigation

[0] Message Index

[#] Next page

Go to full version