[Bug c++/26458] New: Passing a NULL char* into output stream now breaks the output stream
phil at mitre dot org
gcc-bugzilla@gcc.gnu.org
Fri Feb 24 16:53:00 GMT 2006
Prior behavior handled passing a char* with a NULL value into an output stream;
the result was that nothing printed. As of versions 3 and later this behavior
has changed. Perhaps a bug, perhaps a new enforcement.
The result is that the output stream no longer writes anything (to file or
stdout) until the descriptor is closed, and then only the unflushed text up
until the NULL was passed.
Example code:
#include <iostream>
main() {
char *str = NULL;
cout << "Hello " << str << " there" << endl;
cout << "still dead?" << endl;
}
Resulting output is:
Hello_
No further output is sent. Perhaps, if it is deemed improper to allow a NULL
in a known type being passed to a stream, then a SEG fault might be better than
continue with no indication, except for lack of output.
--
Summary: Passing a NULL char* into output stream now breaks the
output stream
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: phil at mitre dot org
GCC build triplet: 2.3.2 20030502 (RedHat linux 2.3.2-53)
GCC host triplet: RedHat linux 2.4.21-37 enterprise
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26458
More information about the Gcc-bugs
mailing list