Seven Original Sins of K&R (Long)

Brian Scearce bls at u02.svl.cdc.com
Fri Oct 5 09:07:35 AEST 1990


browns at iccgcc.decnet.ab.com (Stan Brown, Oak Road Systems) writes:
>>>In article <1990Sep27.131329.26616 at phri.nyu.edu> 
>  roy at phri.nyu.edu (Roy Smith) writes:
>>>>#define NULL (""[0])

This is the same as #define NULL '\0'

>>#define	NULL	0

This is the same as #define NULL 0

Both are different from #define NULL (void *)0

Neither of the suggested #defines are guaranteed to work with
not-all-bits-0-for-NULL implementations if you pass NULL as a
parameter to a function with no prototype in scope.

>Not exactly or precisely.  Every time the first version is invoked, it
>creates a separate instance of a one-byte string.

There's that, too.



More information about the Comp.lang.c mailing list