This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/26458] Passing a NULL char* into output stream now breaks the output stream
- From: "ian at airs dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 13 Mar 2011 07:28:04 +0000
- Subject: [Bug libstdc++/26458] Passing a NULL char* into output stream now breaks the output stream
- Auto-submitted: auto-generated
- References: <bug-26458-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26458
Ian Lance Taylor <ian at airs dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ian at airs dot com
--- Comment #11 from Ian Lance Taylor <ian at airs dot com> 2011-03-13 06:04:06 UTC ---
I don't think the C++ standard requires this behaviour at all when using
operator<< with NULL. The standard says that a pointer value is required to be
non-NULL. That means that passing a pointer value of NULL is undefined
behaviour. The standard imposes no requirement at all.
I think it would be much better if libstdc++ printed "(null)" here as the glibc
printf function does. If that it not acceptable for some odd reason, then I
think we should throw an exception. I think the current behaviour is worse
than useless in practice.