Mail Archives: djgpp/1996/04/15/23:35:08
Malcolm Taylor wrote:
>
> This is a known bug in the gcc2.7.2 sources. When compiling with C++
> structures with the packed attribute on their members don't get packed
> properly. One solution is to compile the code that requires findfirst
> and findnext in C (I have used this soln). However a better solution
> is to edit the dir.h file (I think, the one with struct ffblk) and
> add:
>
> #ifdef __cplusplus
> #pragma pack(1)
> #endif
>
> struct ffblk ...
> ...
>
> #ifdef __cplusplus
> #pragma pack(0)
> #endif
>
> Which will fix the problem (if there is an error in the above then
> feel free to correct me :)
This is a known G++ 2.7.2 bug. But I don't think one has to use
#ifdef __cplusplus things. Simply put #pragma whatever there, it
should also work with the C compiler.
G++ complains to #pragma pack(0) that:
warning: malformed `#pragma pack'
I think you might have to use pack() instead.
Instead of changing <dir.h>, one can use it this way:
#pragma pack(1)
#include <dir.h>
#pragma pack()
There's no danger to do this with <dir.h>.
Does anyone know where the description of those #pragma's is?
>From the info files, I can only realize that Stallman doesn't
like #pragma's.
> Whenever gcc 2.7.3 comes out this problem will no longer exist.
How do you know that? Do you know what new bugs will creep out? :)
> Malcolm
Regards,
Wang TianXing
- Raw text -