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


>>>>> "Nathan" == Nathan Myers <ncm-nospam@cantrip.org> writes:

> 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.

Well, then we shouldn't do that in filebuf_virtuals.cc...

  c1 = fb_03.snextc(); //current in pointer +1
  VERIFY( c1 == '7' );
  c2 = fb_03.sputc('x');  //test current out pointer
  c3 = fb_03.sputc('\n');
  c1 = fb_03.sgetc();

Also, I can't find this in the standard.  Care to point me at a reference?

Jason


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