This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
ends?
- To: libstdc++ List <libstdc++ at sourceware dot cygnus dot com>
- Subject: ends?
- From: "George T. Talbot" <george at moberg dot com>
- Date: Fri, 14 Apr 2000 11:39:33 -0400
- Organization: Moberg Research, Inc.
I had a mistake in my program when I converted my program to use
ostringstream:
#include <iostream>
#include <sstream>
int main(int argc, char*argv[])
{
int number = 4;
ostringstream ost;
ost << "'String" << number << "'" << ends; //oops.
ostringstream crudola;
crudola << "this ";
for (int i=0; i<ost.str().length(); ++i)
{
char ch = ost.str()[i];
switch (ch)
{
case '\'':
crudola << """;
break;
default:
crudola << ch;
}
}
crudola << " that";
cout << crudola.str();
return 0;
}
This program prints: this "String4"
...omitting " that". Should this happen? I would prefer an assertion failure
or a crash to this, although I've since grepped my program for "ends" and
removed it everywhere. I'm using gcc 2.95.2, libstdc++ 2.90.8 on Linux x86.
--
George T. Talbot
<george at moberg dot com>