void * compatibility

Chris Torek chris at mimsy.umd.edu
Thu Sep 20 11:19:00 AEST 1990


In article <8770 at b11.ingr.com> polfer at b11.ingr.com (? Polfer) writes:
>... "Type `void *' is not assignment compatible with type `int (*)()'."
>The compiler is not in full ANSI mode ... [and] Metaware High C
>defines NULL in stdio.h as "(void *)0".

The value ((void *)0) is a generic nil pointer, as well as being a
particular specific nil pointer, and any compiler that believes it
is not suitable in an (int (*)()) context is buggy (at least if the
compiler claims ANSI conformance).

Personally, I think defining NULL as (void *)0 is foolishness: if you
want your compiler to provide complete error checking, you should define
it as `__nil' and make __nil a keyword.  Using (void *)0 fixes a few
specific problems, but leaves others unfixed and unfixable.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list