mssip.h trouble

Patrik Stridvall ps at leissner.se
Tue Sep 10 13:17:33 CDT 2002


> Patrik Stridvall wrote:
> 
> > - No GNU C compiler not even 3.1 support #pragma pack(8) nor
> >   does it support #pragma pack(16). It doesn't even give a warning.
> 
> Well, GCC does support #pragma pack(8) and #pragma pack(16).
> They just don't do anything on i386, because they don't need to.
> 
> What #pragma pack(N) means is: if any structure member would
> require a default alignment > N according to the normal rules,
> reduce that alignment to N.
> 
> As on i386 no structure member ever requires a default alignment
> of > 8, #pragma pack(8) never needs to do anything.
> 
> You appear to think that #pragma pack(N) should sometimes
> *increase* some alignment requirement -- but it never does.

That sound reasonable.

However Microsoft doesn't seem to be reasonable. :-)

> Under what circumstances do you think it should? 

Actually I don't think anything. I have tested what
different compilers does. :-)

As I explain in my latest mail (that perhaps you didn't read since
it was only 5 minutes between the mails :-).

On MSVC it does matter in the following example whether n is 4 or 8.
Or 16 for that matter eventhough that gives the same result as 8.

#ifdef _MSC_VER
typedef __int64 longlong_t;
#else
typedef long long longlong_t;
#endif

#pragma pack(n)
typedef struct {
	char x;
	longlong_t y; /* offset is 4 if n = 4, but is 8 if n = 8 or n = 16*/
} longlong_n;
#pragma pack()



More information about the wine-devel mailing list