Re: [commit] Properly cast sentinels for concat()

Mark Kettenis
2005-07-05T07:36:07Z

Date: Tue, 05 Jul 2005 01:08:22 +0200
From: Eli Zaretskii <eliz@gnu.org>
CC: gdb-patches@sourceware.org
Reply-to: Eli Zaretskii <eliz@gnu.org>

> Date: Mon, 4 Jul 2005 15:36:05 +0200
> From: Mark Kettenis <kettenis@jive.nl>
>
> This fixes a few warnings with GCC 4.0 on OpenBSD. You'll probably
> won't see them on other systems, since they only show up if NULL is
> defined as an integer instead of a pointer constant (both are valid
> according to C standard). The stddef.h that comes with GCC defines
> NULL as (void *)NULL, but we don't use that one on OpenBSD.
>
> Anyway, I committed the attached patch as obvious.

Actually, it's not at all obvious,

Apparently not :(.

it's IMNSHO simply wrong. Casting
NULL to _anything_ should never be needed, unless NULL is abused
(i.e. used in a place where a pointer cannot be). Let's not decide
that a patch is ``obvious'' just because it happens to shut up the
compiler!

Unfortuntaly, as Daniel excellently explained, this isn't just to shut
up the compiler.

In this case, I'd say it's a bug in OpenBSD (it _should_ use stddef.h
that comes with GCC when a program is compiled with GCC), coupled with
the silly attitude of latest GCC versions to whine about more and more
perfectly valid C code constructs.

Let's not argue about these points. There are arguments for both
sides here. But the fact is that OpenBSD does provide it's own
stddef.h, so we have to deal with it.

Mark