This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/5737: ostringstream::str() appends \0 character
- From: paolo at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, paolo at gcc dot gnu dot org, wolfgang dot bangerth at iwr dot uni-heidelberg dot de
- Date: 20 Feb 2002 19:00:22 -0000
- Subject: Re: libstdc++/5737: ostringstream::str() appends \0 character
- Reply-to: paolo at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, paolo at gcc dot gnu dot org, wolfgang dot bangerth at iwr dot uni-heidelberg dot de, gcc-gnats at gcc dot gnu dot org
Synopsis: ostringstream::str() appends \0 character
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Wed Feb 20 11:00:22 2002
Responsible-Changed-Why:
Analyzed
State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Wed Feb 20 11:00:22 2002
State-Changed-Why:
Not a bug.
If you don't want '\0' simply don't output it with << ends!
The semantics of the ends manipulator is exactly that of
outputting a '\0', not that of "closing" in any sensible
meaning (see, f.i., Josuttis, pp. 587, 612, 650).
More generally, an user of the C++ string class is *never*
required to deal with termination chars of any sort.
The ends manipulator is really there only to deal with char*
(i.e., "C") strings (see Josuttis, p. 649-650).
Thanks for your report, Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5737