
21 Jun
2010
21 Jun
'10
12:01 p.m.
Is it common to use different locales for different files?
It is very uncommon to use global locale as... about half of programs will be broken as they not locale-aware. (example boost::lexical_cast<std::string>(1024)=="1.024", many developers would not expect this) On the other hand when locale is used it would be imbued by default to the newly created io-stream. Additional point is the fact that there are may be many C++ locale instances unlike the case of C locales. So the **right** thing to do: 1. Use iostream's locale if you use stream 2. Use your own locale and provide imbue()/getloc() option as io-stream does. Artyom