is (int (*)())NULL legal when NULL is (void *)0?

Doug Gwyn gwyn at smoke.brl.mil
Thu Nov 15 02:22:06 AEST 1990


In article <1391 at gtx.com> randy at gtx.UUCP (Randy D. Miller) writes:
-Can NULL always be cast to a function pointer, even in implementations
-that legally define NULL as (void *)0?  For example, are the following
-lines legal?
-   /* example 1 */     int (*f1)(void) = NULL;
-   /* example 2 */     int (*f2)(void) = (int (*)(void))NULL;

No, the second is not required to be supported by the implementation,
but the first is (3.2.2.3).



More information about the Comp.lang.c mailing list