C locale

Walter Bright newshound2 at digitalmars.com
Fri Sep 27 12:23:11 PDT 2013


On 9/27/2013 10:25 AM, "Luís Marques" <luis at luismarques.eu>" wrote:
> - I asked for what OS the current values were, but for now I assumed they were
> for Linux only. Does anyone besides Sean Kelly know? Is it reasonable to assert
> for the other systems? If not, what's the alternative? Let the compilation fail
> and people wonder why LC_* are not defined?

The idea is:

version (linux)
{
      ...
}
else version (Windows)
{
      ...
}
else version (OSX)
{
     ...
}
else
{
     static assert(0);
}

I.e. the values should be POSITIVELY set for each system, NOT defaulted. The 
advantages are:

1. when you port to a new system, you get compile time errors for every place 
where you need to check/fix the values

2. if you want to fix the values for one system, you don't muck up the values 
for any other system


> - Why, oh why, is "linux" the only OS version() identifier that is not
> capitalized?

Because "linux" is what gcc predefines for Linux. (gcc also sets __gnu_linux, 
__linux__, and __linux, none of which are capitalized. It's the Linux way, not 
some nefarious plot of mine to disparage it.)



More information about the Digitalmars-d mailing list