[Patch] Fix libstdc++/15002 (continued)

Paolo Carlini pcarlini@suse.de
Fri Apr 23 18:37:00 GMT 2004


Pétur Runólfsson wrote:

>Hmmm... the existing tests for getline all seem to use stringbuf. This
>means that getline will always go exactly once through the loop, and
>always take the if (...) branch. It's probably a good idea to add a new
>test.
>
>There is an unbuffered streambuf that could be used to test this in
>testsuite/27_io/basic_istream/extractors_other/char/9424-in.cc
>
Agreed. You will find attached the updated patch. It would be nice to also
have a test going many times through the loop /and/ using traits::find/copy.
If nobody beats me I will prepare one soon, but the below seems now
sufficiently tested and reviewed.

>I'm not sure how much you need to worry about people specializing
>basic_streambuf. After all, the only reason __copy_streambufs works
>is because it is a friend of basic_streambuf, and I haven't seen
>many peoply complaining.
>
Right. In my mind, while summarizing what I have learned, I arrived at the
same conclusion. However, I'm not sure either we want to follow the bad
example of __copy_streambuf ;)

In such circumstances, I'd rather prefer implementing a quick dirty hack
(like mine of today ;) answering immediately user needs  *and* start working
together on the clean and general approach explained by Matt, which will
require some time.

>P.S. Here is a simple way to turn protected access into public without
>using friendship, from Andrei Alexandrescu:
>
This is very interesting and cute, as always happens with Andrei, but, 
again,
overall I don't think we should really go this kind of route! More or 
less it
would mean that we consider the library "... a badly designed framework...",
right? Also, Andrei says that "This still invokes undefined behavior, 
but the
risks are very low.". We must be /very/ careful these days: it looks like
more and more often the library is built also with compilers different from
g++ over which we don't have any control.

Paolo.

/////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_15002_cf
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040423/3d21d468/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_15002_cf
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040423/3d21d468/attachment-0001.ksh>


More information about the Libstdc++ mailing list