C locale
"Luís
"Luís
Fri Sep 27 10:25:14 PDT 2013
On Friday, 27 September 2013 at 04:54:45 UTC, Walter Bright wrote:
> std.c.locale must match the values in the host system's
> <locale.h>. If it doesn't, it's a bug.
Well, I was trying to assess how exactly I should fix it. For
instance, in my local copy I changed it to:
version(linux)
{
enum LC_CTYPE = 0;
enum LC_NUMERIC = 1;
enum LC_TIME = 2;
enum LC_COLLATE = 3;
enum LC_MONETARY = 4;
enum LC_ALL = 6;
enum LC_PAPER = 7; // non-standard
enum LC_NAME = 8; // non-standard
enum LC_ADDRESS = 9; // non-standard
enum LC_TELEPHONE = 10; // non-standard
enum LC_MEASUREMENT = 11; // non-standard
enum LC_IDENTIFICATION = 12; // non-standard
}
else version(OSX)
{
enum LC_ALL = 0;
enum LC_COLLATE = 1;
enum LC_CTYPE = 2;
enum LC_MONETARY = 3;
enum LC_NUMERIC = 4;
enum LC_TIME = 5;
enum LC_MESSAGES = 6;
}
else version(all)
{
static assert(false, "locales not specified for this
system");
}
I have that ready to push in my git repo, but I'm not very happy
about it:
- 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?
- Why, oh why, is "linux" the only OS version() identifier that
is not capitalized? :-) I mean, if you get it wrong the compiler
won't even warn you about it....
What should I do? Do you want me to submit this? Does anyone have
another Posix system laying around and want to check the locale
constants?
More information about the Digitalmars-d
mailing list