public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26458]  New: Passing a NULL char* into output stream now breaks the output stream
@ 2006-02-24 16:53 phil at mitre dot org
  2006-02-24 17:25 ` [Bug libstdc++/26458] " pcarlini at suse dot de
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: phil at mitre dot org @ 2006-02-24 16:53 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <bug-26458-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-03-13 13:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-24 16:53 [Bug c++/26458] New: Passing a NULL char* into output stream now breaks the output stream phil at mitre dot org
2006-02-24 17:25 ` [Bug libstdc++/26458] " pcarlini at suse dot de
2006-02-24 18:48 ` phil at mitre dot org
2006-02-24 18:55 ` phil at mitre dot org
2006-02-24 18:59 ` pinskia at gcc dot gnu dot org
2006-02-24 19:04 ` phil at mitre dot org
2006-02-24 20:40 ` pcarlini at suse dot de
2006-02-24 20:45 ` phil at mitre dot org
2006-02-24 21:04 ` pcarlini at suse dot de
2006-02-24 21:15 ` phil at mitre dot org
2006-02-24 21:32 ` pcarlini at suse dot de
     [not found] <bug-26458-4@http.gcc.gnu.org/bugzilla/>
2011-03-13  7:28 ` ian at airs dot com
2011-03-13 13:11 ` paolo.carlini at oracle dot com

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