Named locales not ok for locales without thousands separator

Paolo Carlini pcarlini@unitus.it
Mon Jan 28 00:55:00 GMT 2002


Nathan Myers wrote:

>What does it mean for a locale to have "no" thousands separator?
>The thousands_sep() member function has no choice but to return
>a character.  (The grouping() member function can return an empty
>string, in which case the thousands separator isn't used.)
>
Now perhaps I'm beginning to get your point. I was sidetracked by the C 
way of dealing with this issue (the corresponding libc function may well 
return the empty string). Therefore, if I understand well what you are 
explaining to me, I'm puzzled as to how the following snippet is 
supposed to work:

locale loc("");

const numpunct<char>& np =
  use_facet<numpunct<char> >(loc);

cout << "Thousands separator = "
     << np.thousands_sep() << endl;

that is, for it_IT or fr_FR, roughly speaking nothing is printed but if 
thousand_sep() return in any case a char, which one in this case???

Cheers,
Paolo.



More information about the Libstdc++ mailing list