Re: C locale

2013-10-18 Thread Luís.Marques
http://d.puremagic.com/issues/show_bug.cgi?id=11293 https://github.com/D-Programming-Language/druntime/pull/641

Re: C locale

2013-09-28 Thread Jacob Carlborg
On 2013-09-28 03:52, Walter Bright wrote: If you're looking for gcc naming consistency, you'll be badly disappointed. Same for D. It's not consistent with GCC neither is it consistent within it self. But we have already had this discussion several times before. No point in having it again.

Re: C locale

2013-09-28 Thread Jacob Carlborg
On 2013-09-28 06:46, "Luís Marques" " wrote: Let's use some lateral thinking. How about a compiler warning if, say, a version statement does not match any defined version identifier but it would if a case-insensitive comparison was made? It's possible to have user defined version identifiers:

Re: C locale

2013-09-28 Thread Jacob Carlborg
On 2013-09-28 01:44, "Luís Marques" " wrote: I can send a pull request with the values filled-in for Windows and OS X. You need FreeBSD as well. Haha :-) I understand, my remark was lighthearted. Still, it seems a bit inconsistent and error prone, given the other identifiers. I mean, I'm all

Re: C locale

2013-09-28 Thread Jacob Carlborg
On 2013-09-28 02:28, "Luís Marques" " wrote: BTW, I have for more than once wondered why there was no way to specify more than one version identifier (is there?), like this: version(Windows, OSX) { enum LC_ALL= 0; enum LC_COLLATE= 1; enum

Re: C locale

2013-09-28 Thread Jacob Carlborg
On 2013-09-27 19:25, "Luís Marques" " wrote: 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? Any file dealing with platform specific functionality need to at least support the following platforms: M

Re: C locale

2013-09-28 Thread Andrei Alexandrescu
On 9/27/13 6:52 PM, Walter Bright wrote: Is it not worth to put a message after the 0/false? (static assert(0, "foo missing"); ) I find assert messages to be redundant, pointlessly repeating what is obvious from the context, and saying things an extra time. But I'm in the minority with that op

Re: C locale

2013-09-27 Thread Walter Bright
On 9/27/2013 9:46 PM, "Luís Marques" " wrote: Let's use some lateral thinking. How about a compiler warning if, say, a version statement does not match any defined version identifier but it would if a case-insensitive comparison was made? Having some of the language be case sensitive and others

Re: C locale

2013-09-27 Thread Luís.Marques
On Saturday, 28 September 2013 at 04:31:41 UTC, Walter Bright wrote: If you're looking for consistency, there isn't any consistent consistency. It's all just a bikeshed issue. I explained why it's "linux", and for better or worse, it is not worth all the grief & disruption changing it. Let's

Re: C locale

2013-09-27 Thread Walter Bright
On 9/27/2013 7:50 PM, "Luís Marques" " wrote: It really is not my intention to start an argument over something inconsequential, but I understood your point was: "´linux´ is the only OS identifier that is not capitalized because that's what's consistent with gcc". But if the other OS identifiers

Re: C locale

2013-09-27 Thread Walter Bright
On 9/27/2013 7:18 PM, "Luís Marques" " wrote: My point here is not to argue against your choice for the standard library. My issues of version(X, Y) arose in client code (non-lib), where it seems to me that the second kind of bug is probably more likely to occur than the first kind. So, I politel

Re: C locale

2013-09-27 Thread Luís.Marques
On Saturday, 28 September 2013 at 01:52:10 UTC, Walter Bright wrote: BTW, does that mean that gcc also defines capitalized "OSX", "Posix", etc.? (otherwise I don't understand your argument) If you're looking for gcc naming consistency, you'll be badly disappointed. It really is not my inten

Re: C locale

2013-09-27 Thread Luís.Marques
On Saturday, 28 September 2013 at 01:42:52 UTC, Walter Bright wrote: For the reason you mentioned earlier. If you are changing the OSX values, you'll likely mess up the Windows ones. I've been at this for 30 years, and am quite fed up with the bugs from attempts to save a few keystrokes. The p

Re: C locale

2013-09-27 Thread Walter Bright
On 9/27/2013 4:44 PM, "Luís Marques" " wrote: On Friday, 27 September 2013 at 19:23:12 UTC, Walter Bright wrote: static assert(0); Do you prefer assert(0) instead of assert(false)? Do whichever you prefer. Is it not worth to put a message after the 0/false? (static assert(0, "foo missi

Re: C locale

2013-09-27 Thread Walter Bright
On 9/27/2013 6:36 PM, Walter Bright wrote: On 9/27/2013 5:28 PM, "Luís Marques" " wrote: BTW, I have for more than once wondered why there was no way to specify more than one version identifier (is there?), like this: version(Windows, OSX) { For the reason you mentioned earlier. If

Re: C locale

2013-09-27 Thread Walter Bright
On 9/27/2013 5:28 PM, "Luís Marques" " wrote: BTW, I have for more than once wondered why there was no way to specify more than one version identifier (is there?), like this: version(Windows, OSX) { For the reason you mentioned earlier. If you are changing the OSX values, you'll lik

Re: C locale

2013-09-27 Thread Luís.Marques
BTW, I have for more than once wondered why there was no way to specify more than one version identifier (is there?), like this: version(Windows, OSX) { enum LC_ALL= 0; enum LC_COLLATE= 1; enum LC_CTYPE = 2; enum LC_MONETARY

Re: C locale

2013-09-27 Thread Luís.Marques
On Friday, 27 September 2013 at 19:23:12 UTC, Walter Bright wrote: static assert(0); Do you prefer assert(0) instead of assert(false)? Is it not worth to put a message after the 0/false? (static assert(0, "foo missing"); ) I can send a pull request with the values filled-in for Windows

Re: C locale

2013-09-27 Thread Walter Bright
On 9/27/2013 10:25 AM, "Luís Marques" " 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

Re: C locale

2013-09-27 Thread H. S. Teoh
On Fri, Sep 27, 2013 at 07:25:14PM +0200, digitalmars-d-boun...@puremagic.com 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 > >. If it doesn't, it's a bug. > > Well, I was trying to assess how exactly I shoul

Re: C locale

2013-09-27 Thread Luís.Marques
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 . 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) { e

Re: C locale

2013-09-27 Thread Luís.Marques
On Friday, 27 September 2013 at 06:43:02 UTC, Jacob Carlborg wrote: You should be using core.stdc.locale, not that it does any difference in this case. Sorry, that's what I meant.

Re: C locale

2013-09-26 Thread Jacob Carlborg
On 2013-09-27 04:38, "Luís Marques" " wrote: On std.c.locate it has: You should be using core.stdc.locale, not that it does any difference in this case. -- /Jacob Carlborg

Re: C locale

2013-09-26 Thread Walter Bright
On 9/26/2013 7:38 PM, "Luís Marques" " wrote: The mismatch of course causes problems. std.c.locale must match the values in the host system's . If it doesn't, it's a bug.

C locale

2013-09-26 Thread Luís.Marques
On my OS X SDK, locale.h has: #define LC_ALL 0 #define LC_COLLATE 1 #define LC_CTYPE2 #define LC_MONETARY 3 #define LC_NUMERIC 4 #define LC_TIME 5 #define LC_MESSAGES 6 #define _LC_LAST