public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/4083: input stream with field width() set reads too much to std::string
@ 2001-08-24 12:26 David Hedbor
0 siblings, 0 replies; 5+ messages in thread
From: David Hedbor @ 2001-08-24 12:26 UTC (permalink / raw)
To: bkoz; +Cc: gcc-prs
The following reply was made to PR libstdc++/4083; it has been noted by GNATS.
From: David Hedbor <david@caudium.net>
To: Benjamin Kosnik <bkoz@redhat.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/4083: input stream with field width() set reads too much to std::string
Date: 24 Aug 2001 12:21:21 -0700
Benjamin Kosnik <bkoz@redhat.com> writes:
> > I assume that in the sections above, 21.3.7.9 is concerning
> > std::string and 27.6.1.2.3 is for char *?
>
> yep
>
> > Sorry for the incorrect bug report.
>
> no worries. I'll close this one.
Ok, great. gcc 3.0 is so much better when it comes to C++ compliance,
which is very nice. However it's also a pain when you have to support
lesser compilers like VC++ (man, it totally blows in the compliance
department) and also previous gcc versions.
Keep up the great work.
--
[ Below is a random fortune, which is unrelated to the above message. ]
A bird in the bush usually has a friend in there with him.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libstdc++/4083: input stream with field width() set reads too much to std::string
@ 2001-08-24 12:26 Benjamin Kosnik
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Kosnik @ 2001-08-24 12:26 UTC (permalink / raw)
To: bkoz; +Cc: gcc-prs
The following reply was made to PR libstdc++/4083; it has been noted by GNATS.
From: Benjamin Kosnik <bkoz@redhat.com>
To: David Hedbor <david@caudium.net>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/4083: input stream with field width() set reads too much to std::string
Date: Fri, 24 Aug 2001 12:16:21 -0700 (PDT)
> I assume that in the sections above, 21.3.7.9 is concerning
> std::string and 27.6.1.2.3 is for char *?
yep
> Sorry for the incorrect bug report.
no worries. I'll close this one.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libstdc++/4083: input stream with field width() set reads too much to std::string
@ 2001-08-24 12:19 bkoz
0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2001-08-24 12:19 UTC (permalink / raw)
To: bkoz, david, gcc-bugs, gcc-prs, grendel
Synopsis: input stream with field width() set reads too much to std::string
State-Changed-From-To: feedback->closed
State-Changed-By: bkoz
State-Changed-When: Fri Aug 24 12:19:10 2001
State-Changed-Why:
Per request
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4083&database=gcc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libstdc++/4083: input stream with field width() set reads too much to std::string
@ 2001-08-24 12:07 bkoz
0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2001-08-24 12:07 UTC (permalink / raw)
To: bkoz, david, gcc-bugs, gcc-prs, grendel, nobody
Synopsis: input stream with field width() set reads too much to std::string
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Fri Aug 24 12:07:52 2001
Responsible-Changed-Why:
Mine.
State-Changed-From-To: open->feedback
State-Changed-By: bkoz
State-Changed-When: Fri Aug 24 12:07:52 2001
State-Changed-Why:
This is not a bug. Both istream operators are working as expected:
- 21.3.7.9 says that
if is.width() is greater than 0, maximum number of appended chars is is.width, with characters extracted and appended until n characters are stored
- 27.6.1.2.3 says that
if is.width() is greater than 0, maximum number of appended chars is is.width, with characters extracted and appended until n-1 characters are stored
Okay?
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4083&database=gcc
^ permalink raw reply [flat|nested] 5+ messages in thread
* libstdc++/4083: input stream with field width() set reads too much to std::string
@ 2001-08-22 12:26 david
0 siblings, 0 replies; 5+ messages in thread
From: david @ 2001-08-22 12:26 UTC (permalink / raw)
To: gcc-gnats; +Cc: grendel
>Number: 4083
>Category: libstdc++
>Synopsis: input stream with field width() set reads too much to std::string
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 22 12:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: David Hedbor
>Release: 3.0.1
>Organization:
>Environment:
Mandrake Cooker linux install, glibc 2.2.3
>Description:
When I set the width of an input stream and when use operator >> to an std::string, one byte too many is read. I.e
"ifs.width(8); ifs >> str;" reads 8 bytes if str is an std::string but 7 bytes if it's a char *. gcc 2.96 (mandrake) and egcs-2.91.66 do now show this problem.
>How-To-Repeat:
Compile and run the attached program.
>Fix:
Unknown. A workaround is to use a temporary char * for reading into.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cpp"
I2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxjc3RkaW8+Cgov
LyBCdWcgaXMgdGhhdCA+PiB0byBhIHN0ZDo6c3RyaW5nLCB3aXRoIHdpZHRoKCkgc2V0LCByZWFk
cyBvbmUgdG9vIG1hbnkgYnl0ZXMuIAppbnQgbWFpbigpIHsKICBzdGQ6OnN0cmluZyBzdHI7CiAg
Y2hhciBzdHIyWzhdOwogIHN0ZDo6aWZzdHJlYW0gaWZzKCJ0ZXN0LmNwcCIsIHN0ZDo6aW9zOjpp
bik7CiAgaWZzLndpZHRoKDgpOwogIGlmcyA+PiBzdHI7CiAgc3RkOjppZnN0cmVhbSBpZnMyKCJ0
ZXN0LmNwcCIsIHN0ZDo6aW9zOjppbik7CiAgaWZzMi53aWR0aCg4KTsKICBpZnMyID4+IHN0cjI7
CiAgcHJpbnRmKCJzdHIubGVuZ3RoKCkgPSAlZCwgc3RybGVuKHN0ci5jX3N0cigpKSA9ICVkXG5z
dHJsZW4oc3RyMikgPT0gJWRcbiIsCgkgc3RyLmxlbmd0aCgpLCBzdHJsZW4oc3RyLmNfc3RyKCkp
LCBzdHJsZW4oc3RyMikpOwp9Cg==
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-08-24 12:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-24 12:26 libstdc++/4083: input stream with field width() set reads too much to std::string David Hedbor
-- strict thread matches above, loose matches on Subject: below --
2001-08-24 12:26 Benjamin Kosnik
2001-08-24 12:19 bkoz
2001-08-24 12:07 bkoz
2001-08-22 12:26 david
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).