condition convention 'if (10 == j)...'
Peter S. Shenkin
peters at cubsvax.UUCP
Tue Apr 30 13:44:14 AEST 1985
In article <> oacb2 at ut-ngp.UUCP writes:
>> Just that instead of writing, in the traditional manner,
>> if(pc=malloc(nbytes)==NULL)...
>> you have to insert extra parens if you use the other form:
>> if(NULL==(pc=malloc(nbytes)))..
>
>Huh??? The first sets pc to 0 or 1 depending on whether the result of
>malloc is or is not NULL. The second sets pc to the result of malloc.
>
> Mike Rubenstein, OACB, UT Medical Branch, Galveston TX 77550
As the contributor of this chestnut ( marked >> ), I acknowledge the egg
on my face. Guess that's not why I stopped using "if(CONST==var)..." after
all (At least I hope not! :-) ). -P. Shenkin
(And also thanks to those who pointed out my error via mail.)
More information about the Comp.lang.c
mailing list