Date: Sun, 3 May 1998 17:42:05 +0300 (IDT) From: Eli Zaretskii To: "John M. Aldrich" cc: djgpp AT delorie DOT com Subject: Re: OTP: European decimal notation (Was Re: Problems with paranoia.c and pow(0,0)) In-Reply-To: <3547B0B9.2B05@cs.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Wed, 29 Apr 1998, John M. Aldrich wrote: > So, is there a special language variant of C/C++ for Europeans where the > role of ',' and '.' are reversed, and special European calculators and > numeric keypads? Or do you just have to remember to type numbers in the > American style when you program? It could be extremely confusing either > way. This pertains to locales. ANSI C has a provision for `setlocale' and `localeconv' functions (which see) to solve this. (Sadly, DJGPP currently doesn't implement anything beyond the minimum.) The drawback of this is that you can only have a single locale active at any given time, so if you need to do I/O in two or more different notations, you are in for some hard work. C++ has a facility called ``facets'' which is a generalization of locales. Of course, it all calls for programmer's vigilance to write code that sets a correct locale and complies with the current locale, which might explain why so many programs don't. FWIW, GNU Emacs looks up the environment for locale-related variables at startup, and changes its behavior accordingly (not as far as the comma goes, though), so it's not impossible.