Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: wide codecv...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 9577 of 9831
Post > Topic >>

Re: wide codecvt not used unless sync_with_stdio(false)

by Oncaphillis <ocaphillis@[EMAIL PROTECTED] > May 8, 2008 at 09:30 PM

> 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! ]
 




 3 Posts in Topic:
wide codecvt not used unless sync_with_stdio(false)
Frank Birbacher <blood  2008-05-07 11:43:28 
Re: wide codecvt not used unless sync_with_stdio(false)
Oncaphillis <ocaphilli  2008-05-08 21:30:56 
Re: wide codecvt not used unless sync_with_stdio(false)
"sebor@[EMAIL PROTEC  2008-05-09 09:15:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:50:23 CDT 2008.