Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2004 22:07:17 +0300
From:      Valentin Nechayev <netch@lucky.net>
To:        "JINMEI Tatuya / ?$B?@L@C#:H" <jinmei@isl.rdc.toshiba.co.jp>
Cc:        Thomas Quinot <thomas@freebsd.org>
Subject:   Re: freeaddrinfo(NULL)
Message-ID:  <20040921190717.GG84228@lucky.net>
In-Reply-To: <y7visa7h2ki.wl@ocean.jinmei.org>
References:  <20040921123016.GA41677@melusine.cuivre.fr.eu.org> <y7visa7h2ki.wl@ocean.jinmei.org>

next in thread | previous in thread | raw e-mail | index | archive | help
 Wed, Sep 22, 2004 at 03:58:05, jinmei wrote about "Re: freeaddrinfo(NULL)": 

> As Umemoto-san said, if we made freeaddrinfo(NULL) "safe", the
> application programmers might tend to rely on the "safety net" and
> the uncareful coding style.  This can be worse than the segfault here,

Let you try to apply the same arguments to free() and you'll see nonsense.
If free(NULL) is freely allowed, what's the problem with freeaddrinfo()?

> because the reason for the NULL argument might be a bug in the
> program, and, as a result of hiding the bug by making

NULL was specially designed by C authors as special value, "no valid pointer
here". One may wrap anything with "if(p) freeaddrinfo(p);", but this
has no deep sense and leads only to style flames.

> freeaddrinfo(NULL) "safe", it might cause much more serious effects
> later in the program.

What effects? Why they doesn't appear with another pointer?

> In my understanding, this kind of discussion has always been
> controversial; whether we want to make more explicit errors (even if
> those are segfaults), or whether we want to "spoil" bad programmers by
> making the library interface "safe".

Segfaulting on NULL makes nothing more safe.



-netch-



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040921190717.GG84228>