J
J Trauntvein
I was working with a co-worker the other day to work through the
process of formatting numeric values by imbueing C++ iostreams with
locales. His program's initialisation code had a call to
setlocale("",LC_ALL) which I believe sets up locale information for the
C run time library but is not supposed to effect the C++ run time.
What we found, however, was that, with this function call in place, the
C++ iostreams were formatting floating point values according to the US
convention (commas as a thousands separator and periods as a decimal)
even though the stream was imbued with a different locale (Brasilian
Portuguese in our case). We found that, if we removed the above
mentioned call that the iostream formatting worked aas we expected. My
question is whether this interaction is a bug or is it rather an
unfortunate but planned side effect that comes from mixing the "C"
and C++ locales models?
Regards,
Jon Trauntvein
process of formatting numeric values by imbueing C++ iostreams with
locales. His program's initialisation code had a call to
setlocale("",LC_ALL) which I believe sets up locale information for the
C run time library but is not supposed to effect the C++ run time.
What we found, however, was that, with this function call in place, the
C++ iostreams were formatting floating point values according to the US
convention (commas as a thousands separator and periods as a decimal)
even though the stream was imbued with a different locale (Brasilian
Portuguese in our case). We found that, if we removed the above
mentioned call that the iostream formatting worked aas we expected. My
question is whether this interaction is a bug or is it rather an
unfortunate but planned side effect that comes from mixing the "C"
and C++ locales models?
Regards,
Jon Trauntvein