Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2002 17:21:16 -0700
From:      "David O'Brien" <obrien@freebsd.org>
To:        Archie Cobbs <archie@dellroad.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: NULL
Message-ID:  <20020821002116.GA33223@dragon.nuxi.com>
In-Reply-To: <200208202344.g7KNioV03523@arch20m.dellroad.org>
References:  <200208202344.g7KNioV03523@arch20m.dellroad.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 20, 2002 at 04:44:50PM -0700, Archie Cobbs wrote:
> Simple question...
> Why isn't NULL defined to be "((void *)0)" instead of "0" ?

In C++ this is not legal:

    void blah(void) {
        int *foo;
        void *bar;
        bar = foo;
        foo = bar;
    }

it is in C, but we share the definition.
A benefit of "(void *)0" is that this would be caught:

    char c = NULL;

rather than the correct:
    char c = '\0';

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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