On Fri, Sep 27, 2013 at 07:25:14PM +0200, [email protected] wrote: > 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? [...]
Walter's stance, IIRC, is that this code should only compile for the platforms on which the values have been verified, and static assert(0) for everything else. Every other platform will break, of course, but that's what tells us what other OSes we need to verify the values for. FWIW, I just verified the correctness of the version(linux) block above against /usr/include/locale.h on my system (Linux 64-bit Debian/unstable). Sadly, I don't have access to other Posix OSes so I can't say much beyond this. T -- I'm still trying to find a pun for "punishment"...
