Abandon NULL for (0)
Scott Amspoker
scott at bbxsda.UUCP
Sat Sep 23 01:50:16 AEST 1989
In article <17505 at pasteur.Berkeley.EDU> jas at postgres.berkeley.edu (Jim Shankland) writes:
>>At home I use 0 for a null pointer. I test pointers with expressions
>>like:
>> if (pointer)... /* at home */
>> if (!pointer)...
>
>Stylistically a little dubious, in my opinion, but certainly widely
^^^^^^^^^^^^^^
I guess that's where personal preference comes in. I consider it
a lot easier to read that way (and to type in :-).
>>as opposed to
>>
>> if (pointer!=(char *)0) /* at work */
>>
>Modern C compilers will reliably generate warnings on this if `pointer'
>has any type other than `char *'.
Sorry I wasn't clear on this. It was simply a general example. Of
course I would use the appropriate pointer type in the cast.
--
Scott Amspoker
Basis International, Albuquerque, NM
(505) 345-5232
More information about the Comp.lang.c
mailing list