Subject: Re: mklocale, take 2
To: None <tech-toolchain@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-toolchain
Date: 10/21/2001 22:41:33
>>> 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.
> No, not really.  You're assuming htat "#pragma pack" always means the
> same thing --pack structs -- to all implementations. It needn't.

And not only that, that it means it with the same detailed symantics.

One compiler may want

#pragma pack 1
struct ...
#pragma pack 0

and another may want

struct foo { ... }
#pragma pack(struct foo)

and the third may want

#pragma pack /* applies to the next struct encountered */
struct ...

and another may want

#pragma pack struct
struct ...
#pragma nopack struct

and a fifth way might be

struct { ...
#pragma pack /* applies to every struct it is encountered within */
... };

That's five incompatibly different ways, right off the top of my head.
There are probably at least as many more that are more obscure.

> (NB: i'm just recycling RMS' arguemnt from the early 90s.)

What RMS never noticed - or at least never seemed to notice - is that
exactly the same argument applies to __attribute__.  Or any other
nonstandard extension.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B