Mail Archives: djgpp/1996/06/03/07:13:11
On Mon, 3 Jun 1996, Jorrit Tyberghein wrote:
> But when I compile this program with 'gcc -x c++ -o test test.c'
> (so I'm using the C++ compiler) it doesn't work correctly anymore.
> In the output the two first characters are missing. I have to change
> the printf line to 'printf ("%s\n", ff.fa_name-2);' to get the
> correct output.
This is a known bug in GCC 2.7.2: the C++ compiler doesn't pack
structures correctly. A work-around is to surround the struct ff_blk
declaration on <dir.h> with these:
#ifdef __cplusplus
#pragma pack(1)
#endif
.
.
.
#ifdef __cplusplus
#pragma pack()
#endif
- Raw text -