This is the mail archive of the libstdc++@sources.redhat.com 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]

Re: [bug] istream::getline(char*,streamsize) still broken


On 20 Jul 2000 at 22:31 (-0700), Benjamin Kosnik wrote:
| > 27.6.1.3 says:
| 
| extracts chars and stores them into successive locaitons of an aray whos 
| first element is designated by S. Characters are extracted and stored 
| until one of the following occurs:
| 
| 1) eof
| 
| 2) c == delim
| 
| 3) n - 1 stored
| 
| conditions tested in order shown

exactly! when bullet #2 is true, we _just_extracted_ and tested
the delim case. gcount() reflects _all_ extracted chars, not just
those which were stored, so gcount() is number_of_chars_stored+1.

am I missing something here? (it wouldn't be the first/last time ;)

|
| > ... so we canmust extract n characters
| 
| no, not if n - 1 are stored. Then no more are extracted...

correct, but the delim is _not_ stored, so we are still storing n-1 
chars into the storage array, when the nth extracted char is the delim.

gcount() returns the number of characters _extracted_

| > character is the delimiter. I still believe the patch to istream.cc 
| > will enforce proper behavior. It does cause a couple of failures (bad 
| > tests IMO) in the testsuite, which I will address/justify when I get 
| > a breather :) I _seriously_ believe the tests in the original message 
| > accurately enforce the std.
| 
| Hmm. You haven't proven your case

argh! and I was hoping to sleep this night.

anyway, before I crash, I reiterate:
gcount() returns the number of characters _extracted_

| ;)
| 
| In anycase, a patch that admits testcase breakage is probably a better 
| way to go, so next time at least note that things broke (or make the 
| changes and add commentary--which is by far the superior solution.)

agreed :)  I'll post a patch with a few testsuite changes by Monday.
I'll make sure that we test handling the case mentioned in the
'smoke filled room' comment in the current istream.tcc

cheers!
  Brent

-- 
Damon Brent Verner                        o      _     _         _
Cracker Jack? Surprise Certified  _o     /\_   _ \\o  (_)\__/o  (_)
brent@rcfile.org                _< \_   _>(_) (_)/<_    \_| \   _|/' \/
brent@linux1.org               (_)>(_) (_)        (_)   (_)    (_)'  _\o_

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