cerr and NULL terminates program + string::find() weird results

Anibal Jodorcovsky anibal@intelerad.com
Wed Oct 16 14:43:00 GMT 2002


well, how about (null) and dumping core. At least we know why and then it's
easier to find the problem?

-Anibal

----- Original Message -----
From: "Gabriel Dos Reis" <gdr@integrable-solutions.net>
To: "Anibal Jodorcovsky" <anibal@intelerad.com>
Cc: <libstdc++@gcc.gnu.org>; <neelin@intelerad.com>; "Kent Tse"
<kent@intelerad.com>
Sent: Wednesday, October 16, 2002 8:37 AM
Subject: Re: cerr and NULL terminates program + string::find() weird results


> "Anibal Jodorcovsky" <anibal@intelerad.com> writes:
>
> | It surely does! :-)
> |
> | What I don't understand is how this 'undefined behaviour' is ok.
>
> By definition, anything happening is OK.
>
> | How can the program just exit? I've seen other implementations that at
least
> | they print a (null) or something like that.
>
> I don't consider that is really a favor -- at least not for me
> (hearing my user hat).  How can one distinguish from the string
> "(null)" output on std::cerr?
>
> Sending NULL on a stream is asking for trouble, that is should be
> fixed as soon as possible.  Second-guessing what should be printed
> isn't a service, IMHO.
>
> | I don't think it's too
> | outrageous to ask for something like that. Imagine if you're passing a
char*
> | around and because of one bug somewhere it gets assigned to NULL and
then
> | cerr gets called, wham! the program silently exits, no core, nothing...
>
> Oh, maybe dumping core would be a sensible thing to consider and to
> do, but I don't buy "(null)".
>
> -- Gaby



More information about the Libstdc++ mailing list