This is the mail archive of the
mailing list for the libstdc++ project.
Re: [Patch/RFC] Fix libstdc++/9533
On Tue, Mar 18, 2003 at 03:04:42PM -0000, P?tur Run?lfsson wrote:
> Benjamin Kosnik wrote:
> > I think it might be best to remove the patch for 6746 entirely, and
> > start over.
> I think is the only reasonable approach for the 3.3 branch, the
> proposed changes to showmanyc seem way too complex to apply this
> close to release.
> By the way, shouldn't 9533 be changed to high priority? It is a
> regression from 3.2.x and IMHO it is a show-stopper.
> > My real wish is to separate out the buffered/unbuffered
> > classes though, before much more work on this kind of issue happens.
> I'm not sure that it is ever correct to use basic_filebuf as a
> stream buffer for cin/cout/wcin/wcout etc.
> Consider this fragment from 27.3:
> Mixing operations on corresponding wide- and narrow-character
> streams follows the same semantics as mixing such operations
> on FILEs, as specified in Amendment 1 of the ISO C standard.
I agree. I think that, after sync_with_stdio(false) has been called,
the only conforming buffered streambuf possible is an object derived
from both basic_streambuf<char> and basic_streambuf<wchar_t>.
When the last operation done is through the char interface,
the buffer pointers for the wchar_t interface are set all equal,
so that when a wide character operation is attempted, underflow
can re-interpret the raw input according to the current locale.
This is pretty simple to implement, particularly since we don't
have support seeking or output. (Putback is a bit tricky.)
There's no particular reason to want to use filebuf for cin or
cout, aside from a commendable laziness.
ncm-nospam at cantrip dot org