> When I use sync_with_stdio(false), however, the output is the same as
> the contents of the test file.
>
> The "Standard C++ IOStreams and Locales" [Langer&Kreft] state "The first
> operation that is performed on a C file determines its orientation"
> (page 59) meaning: deciding between narrow and wide output. As I'm not
> using the stdio here, sould sync_with_stdio possibly affect the use of a
> code conversion facet?
>
> Regards, Frank
>
Somewhere in the gcc-docs I read that this is standard behavior
sync_with_stdio(true) which is the default tells the iostream
library to delegate all buffering and code conversion to the C
stdio library. Since functions like fputwc take their transcoding
info from the current locale and C++ streams can be manipulated
via imbue it would be possible to have two different code conversion
settings in the frontend and the backend. To prevent this the
gcc++lib ignores all code conversion if sync_with_stdio(false)
isn't called before any I/O on the streams.
It doesn't have anything to do with the boost-facet it's the same
with all codecvt-factes provided by g++lib. If you stick to the
streams anyway and ignore the C-stdio calls I think you're on the
save side. Although I don't know if this holds true with
library calls which might, behind your back, call stdio functions.
Furthermore it seems that sync_with_stdio is very differently
implemented on different platforms as L&K point out.
So, as always it's not a bug, it's a feature
Hope that helps
O.
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|