Article View: comp.std.c++
Article #2475Question re: ostream::operator<<(wchar_t)
From: Shankar Unni
Date: Thu, 09 Nov 1995 05:51
Date: Thu, 09 Nov 1995 05:51
24 lines
1837 bytes
1837 bytes
I have to implement an ostream::operator<<(wchar_t) (for a USL-derived iostream library, with a builtin wchar_t type), and ran into the question: exactly what should this operator write to the stream? >From the Sep 95 draft, it seems that (page 27-51) basic_ostream<wchar_t>::operator<<(wchar_t) should convert its argument with a "%c" printf specifier. But surely this is a mistake or an oversight, since it doesn't mean anything for wchar_t: the wchar_t will be cast to a "char" and written, destroying its value. My question is: are the input and output operators for wchar_t-based streams required to do this (silly, IMHO) behavior? Or does it make more sense for them to read and write multi-byte strings, converting to / from wchar_t as needed (which is what the scanf/printf "%C" and "%S" operators do)? -- Shankar Unni E-Mail: shankar@sgi.com Silicon Graphics Inc. Phone: +1-415-933-2072 URL: http://reality.sgi.com/employees/shankar --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<9511081145.ZM2073@boris.engr.sgi.com>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 09 Nov 95 05:51:58 GMT
Approved: fjh@cs.mu.oz.au
Organization: -
Newsgroups: comp.std.c++
From: "Shankar Unni" <shankar@boris.engr.sgi.com>
Message-ID: <9511081145.ZM2073@boris.engr.sgi.com>
X-Original-Date: Wed, 8 Nov 1995 11:45:02 -0800
X-Mailer: Z-Mail (3.2.2 10apr95 MediaMail)
Subject: Question re: ostream::operator<<(wchar_t)
Cc: mnm@boris.engr.sgi.com, jfw@boris.engr.sgi.com, myersn@roguewave.com,
shankar@boris.engr.sgi.com
X-Auth: PGPMoose V1.1 PGP comp.std.c++
iQBFAgUBMKGXFeEDnX0m9pzZAQEfOAGAnfSL4Cy21x+y0V66Oh7/qQ1ZAEv5iU/Z
Wv9Dd+hGRClCvfFAUhwweSmybYGcFKGQ
=AMsb