------- Comment #1 from paolo dot carlini at oracle dot com  2008-12-03 10:34 
-------
This sort-of inconsistency is essentially due to the glibc specifics (+ the
fact that we are dealing separately with "C" locale) see the below GNU C
snippet. In particular, note in numeric_members.cc that we already deal
correctly with the possibility of THOUSANDS_SEP == '\0'. In my opinion, all the
past discussions in this area considered, we should only tweak
monetary_members.cc vs __MON_DECIMAL_POINT == '\0' (possibly
__MON_THOUSANDS_SEP == '\0' too) in complete analogy with numeric_members.cc vs
THOUSANDS_SEP == '\0'.

/////////////

#define _GNU_SOURCE

#include <locale.h>
#include <stdio.h>
#include <langinfo.h>
#include <assert.h>

int main()
{
  __locale_t cloc = 0;
  char ts = 'z';

  cloc = __newlocale(1 << LC_ALL,
"LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C",
cloc);

  ts = *(nl_langinfo_l(THOUSANDS_SEP, cloc));

  assert( ts == '\0' );

  printf("%c\n", ts);

  cloc = 0;
  ts = 'z';

  cloc = __newlocale(1 << LC_ALL,
"LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C",
cloc);

  ts = *(nl_langinfo_l(__MON_DECIMAL_POINT /*__MON_THOUSANDS_SEP*/, cloc));

  assert( ts == '\0' );

  printf("%c\n", ts);

  return 0;
}


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo at gcc dot gnu dot
                   |                            |org, bkoz at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38368

Reply via email to