locale::global and wcout

Paolo Carlini pcarlini@suse.de
Mon Jul 2 23:50:00 GMT 2007


Hi,

first, a slightly pedantic but important observation: there is only 
*one* standard in force, the ISO / IEC Standard 14882: 2003, available 
in pdf from ISO or in printed form from Wiley: anything else, in 
particular online documents or manuals / books are certainly useful 
while learning and studying the C++ language but do not represent by 
themselves a standard in any sense.

That said, in the area of locale vs streams, a lot is implementation 
defined: our implementation, by defaults has the predefined streams 
(cin, cout, wcin, wcout...) synced with stdio. That means that certainly 
the wchar_t versions are sensible to the global locale, because they use 
directly the underlying wchar_t C library functions to achieve that 
sync. You can change that behavior (thus loosing the sync) by calling 
sync_with_stdio(false) before any I / O.

Paolo.



More information about the Libstdc++ mailing list