Subject: Re: mklocale, take 2
To: Todd Vierling <firstname.lastname@example.org>
From: Richard Earnshaw <email@example.com>
Date: 10/19/2001 10:08:38
> On Thu, 18 Oct 2001, Aaron J. Grier wrote:
> : > Now, as far as having a packed attribute flag in cdefs.h, we might
> : > want to consider using "#pragma pack" as opposed to an attribute that
> : > might be required to appear in different places in the struct's
> : > definition on different compilers. "#pragma pack" is much more widely
> : > supported, and would cause the compile to fail (a good thing!) if
> : > packed structs aren't provided by the compiler.
> : aren't #pragmas are by definition compiler-specific?
> Yes, and that's the point. If the compiler doesn't support packed structs,
> the code should be uncompilable on that compiler. (Otherwise you'll end up
> with nondescript errors and crashes thanks to the improper alignment of
> data in the struct.)
I believe the C standard allows compilers to ignore silently any pragma it
doesn't recognize. So this doesn't guarantee it will not compile.