public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/2830: incorrect inserter for std::string
@ 2001-05-15 12:36 Phil Edwards
  0 siblings, 0 replies; 3+ messages in thread
From: Phil Edwards @ 2001-05-15 12:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/2830; it has been noted by GNATS.

From: Phil Edwards <pedwards@disaster.jaj.com>
To: kenny.simpson@gs.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/2830: incorrect inserter for std::string
Date: Tue, 15 May 2001 14:09:39 -0400

 On Tue, May 15, 2001 at 07:07:27PM -0000, kenny.simpson@gs.com wrote:
 > At the end of bits/ostream.tcc I see:
 > 
 > // 21.3.7.8 basic_string::operator<<
 > ...
 >     { return (__out << __s.c_str()); }
 > 
 > first, shouldn't this be 21.3.7.9? as 21.3.7.8 describes swap.
 
 Yes, good catch.
 
 > second, this won't handle '\0's properly.
 
 Do you have a small testcase?
 
 
 Phil
 
 -- 
 pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
 devphil at several other less interesting addresses in various dot domains
 The gods do not protect fools.  Fools are protected by more capable fools.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: libstdc++/2830: incorrect inserter for std::string
@ 2001-05-15 12:36 Simpson, Kenny
  0 siblings, 0 replies; 3+ messages in thread
From: Simpson, Kenny @ 2001-05-15 12:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/2830; it has been noted by GNATS.

From: "Simpson, Kenny" <Kenny.Simpson@gs.com>
To: 'Phil Edwards' <pedwards@disaster.jaj.com>, Kenny.Simpson@gs.com
Cc: gcc-gnats@gcc.gnu.org
Subject: RE: libstdc++/2830: incorrect inserter for std::string
Date: Tue, 15 May 2001 15:33:47 -0400

 #include <iostream> // for std::cout
 #include <string>
 
 int main()
 {
   std::string blanks( 3, '\0');
   std::string foo = "hello";
   foo += blanks;
   foo += "world\n";
   std::cout << bar;
   return 0;
 }
 
 This should print "hello\0\0\0world\n" to std::cout,
 but by sending bar.c_str(), all that gets sent is "hello".
 
 -Kenny
 
 -----Original Message-----
 From: Phil Edwards [ mailto:pedwards@disaster.jaj.com ]
 Sent: Tuesday, May 15, 2001 2:10 PM
 To: Kenny.Simpson@gs.com
 Cc: gcc-gnats@gcc.gnu.org
 Subject: Re: libstdc++/2830: incorrect inserter for std::string
 
 
 On Tue, May 15, 2001 at 07:07:27PM -0000, kenny.simpson@gs.com wrote:
 > At the end of bits/ostream.tcc I see:
 > 
 > // 21.3.7.8 basic_string::operator<<
 > ...
 >     { return (__out << __s.c_str()); }
 > 
 > first, shouldn't this be 21.3.7.9? as 21.3.7.8 describes swap.
 
 Yes, good catch.
 
 > second, this won't handle '\0's properly.
 
 Do you have a small testcase?
 
 
 Phil
 
 -- 
 pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
 devphil at several other less interesting addresses in various dot domains
 The gods do not protect fools.  Fools are protected by more capable fools.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libstdc++/2830: incorrect inserter for std::string
@ 2001-05-15 12:16 kenny.simpson
  0 siblings, 0 replies; 3+ messages in thread
From: kenny.simpson @ 2001-05-15 12:16 UTC (permalink / raw)
  To: gcc-gnats; +Cc: theonetruekenny

>Number:         2830
>Category:       libstdc++
>Synopsis:       incorrect inserter for std::string
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 15 12:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     kenny.simpson@gs.com
>Release:        20010507 snapshot
>Organization:
>Environment:
looking over the code
>Description:
At the end of bits/ostream.tcc I see:

// 21.3.7.8 basic_string::operator<<
...
    { return (__out << __s.c_str()); }

first, shouldn't this be 21.3.7.9? as 21.3.7.8 describes swap.
second, this won't handle '\0's properly.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-05-15 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-15 12:36 libstdc++/2830: incorrect inserter for std::string Phil Edwards
  -- strict thread matches above, loose matches on Subject: below --
2001-05-15 12:36 Simpson, Kenny
2001-05-15 12:16 kenny.simpson

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