`if (a = b)' (was Standard indentation?)

Chris Torek chris at mimsy.UUCP
Wed Dec 14 17:00:04 AEST 1988


>In article <14945 at mimsy.UUCP> I wrote:
>>I still prefer ....

In article <1683 at valhalla.ee.rochester.edu> badri at valhalla.ee.rochester.edu
(Badri Lokanathan) writes:
>I am missing something here. Why is
>
>a = expr; if (a == b) {statement}
>
>preferable, in general, to
>
>if ((a = expr) == b) {statement}

It is not.  That is why I said `I prefer' rather than `it is better'.
The one that I believe is objectively worse than its alternatives is

	if (l = r) ...

vs any of

0.	l = r;
	if (l) ...

1.	l = r;
	if (l != 0) ...

2.	if ((l = r) != 0) ...
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list