Assignment in test: OK?

Henry Spencer henry at zoo.toronto.edu
Thu Sep 20 02:43:08 AEST 1990


In article <1335:Sep1901:50:0490 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>> `:=' is almost as clumsy to type as that
>>   stupid regexp notation `\( \)'.
>
>I agree! That's why Q lets you use = in 99% of the cases where you'd use
>it in C. You only have to resort to := when you want to use the assigned
>value in an expression.

So why not just insist on proper parenthesization and testing of the value
in an expression -- that is, the clean and readable

	if ((c = getchar()) != '\0')

rather than the cryptic and confusing

	if (c = getchar())

and leave the operator alone?  Then you have the further bonus that it's
not a new language, just a fussier compiler.
-- 
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday|  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.lang.c mailing list