Message-ID: <31730086.2007@public1.guangzhou.gd.cn> Date: Tue, 16 Apr 1996 11:05:58 +0900 From: Wang TianXing Organization: No Organization MIME-Version: 1.0 To: malcolm AT manawatu DOT gen DOT nz CC: djgpp AT delorie DOT com Subject: Re: dir.h problem References: <199604121413 DOT KAA20749 AT delorie DOT com> <4kt899$njn AT news DOT manawatu DOT gen DOT nz> Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 7bit 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 , one can use it this way: #pragma pack(1) #include #pragma pack() There's no danger to do this with . 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