trying to simplify an algorithm

Hui Zhou zhouhui at wam.umd.edu
Tue Mar 1 07:33:10 PST 2005


On Tue, Mar 01, 2005 at 08:25:26AM -0700, Kevin P. Fleming wrote:
>Hui Zhou wrote:
>
>>I always frowns at statements such as    if (fopen(...))...
>>I prefer the usage:
>>    if (NULL != fopen(...))...
>
>This is bad, bad, BAD.
>
>Never, ever, ever use NULL to compare to anything that is not a pointer. 
>If you are checking for zero, use zero.

;-) Actually fopen returns a pointer! I guess I meant to say the 
statement made it clear that fopen returns a pointer and we are 
testing whether it is NULL. 

However, in C, pointer is integer, another feature sometime frowned 
upon.

-- 
Hui Zhou



More information about the lfs-chat mailing list