Article View: comp.std.c
Article #4396Re: null pointer constant
From: J. Kanze
Date: Mon, 27 Nov 1995 10:05
Date: Mon, 27 Nov 1995 10:05
23 lines
1414 bytes
1414 bytes
Denizen of the Deep (becker@Xenon.Stanford.EDU) wrote:
|> If the type (void *) is not compatible with pointer-to-function
|> types, then why is the expression (void *)0 a legal null
|> pointer constant?
Because the standard says so.
|> Since the null pointer constant is assignable to a pointer-to-
|> function, it seems that this is rather misleading.
No more so that using an integral 0. After all, integers are not
normally pointers to functions either.
Most languages have a special keyword for the null pointer (e.g.: NIL,
in the Pascal family). This is really just begging the question,
though. There is no way of expressing the type of this value in the
type system. At least in C, the hack is evident and transparent.
--
James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
Technical Details
Message-ID:
<49c2hj$o7j@gabi.gabi-soft.fr>Path:
arc1-ca.pugleaf.net!gabi-soft.fr!not-for-mailReferences:
<49b202$62t@nntp.Stanford.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gabi-soft.fr!not-for-mail From: kanze@gabi-soft.fr (J. Kanze) Newsgroups: comp.std.c Subject: Re: null pointer constant Date: 27 Nov 1995 11:05:38 +0100 Organization: GABI Software, Sarl. Message-ID: <49c2hj$o7j@gabi.gabi-soft.fr> References: <49b202$62t@nntp.Stanford.EDU> NNTP-Posting-Host: gabi.gabi-soft.fr X-Newsreader: TIN [version 1.2 PL2]