Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2018 23:06:11 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Conrad Meyer <cem@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r336835 - head/lib/libc/gen
Message-ID:  <20180728200611.GA40119@kib.kiev.ua>
In-Reply-To: <201807281908.w6SJ80qo089859@repo.freebsd.org>
References:  <201807281908.w6SJ80qo089859@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jul 28, 2018 at 07:08:00PM +0000, Conrad Meyer wrote:
>   For unclear reasons, POSIX' definition of these routines spells NULL as
>   "(char *)0."  This is needlessly unclear.  One guess might be that POSIX
>   targets more exotic computer architectures than FreeBSD does.  Fortunately,
>   there is no such problem on any reasonable platform for FreeBSD to support.
>   Spell NULL as NULL.

The reasons are quite clear. Practically NULL has to be defined as '0'
or '0L' at best, for C and esp. C++ rules of the pointers automatic
casts to work. This means that NULL cannot be used in vararg lists where
the pointer is expected.

In other words, the (char *)0 part of the pre-commit text was correct,
while after-commit use of NULL only works on machines where pointers
have the same representation as ints or longs.



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