This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/4150: catastrophic performance decrease in C++ code


On Thu, Apr 18, 2002 at 03:18:17AM +0100, Jason Merrill wrote:
> >>>>> "Jason" == Jason Merrill <jason@redhat.com> writes:
> 
> ... how often do people
> really read a few characters, write a few characters, and then read a few
> more characters without an intervening seek?
> 
> A problem with the current implementation of this is that if we do a read
> on an input/output filebuf, we end up writing the contents of the buffer
> back out to the file, even if we've never requested a write.  Oops.

Not only that, it's undefined behavior to switch between reading
and writing without a seek between.  We don't have to make it do
anything "reasonable" in that case, but might just as well set 
badbit if that were convenient, as a favor to users who might not
otherwise have known they were corrupting their stream state.
 
Nathan Myers
ncm at cantrip dot org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]