When do you use "if ( a = b )"?

Doug Gwyn gwyn at smoke.brl.mil
Wed Mar 27 08:28:53 AEST 1991


In article <15053 at ganymede.inmos.co.uk> conor at inmos.co.uk (Conor O'Neill) writes:
>To me it is clear that using assignments inside conditions is very bad
>style because it makes the intention of the original programmer unclear.

I think it depends on context and familiraity with common C idioms.
Consider

	while ( (c = getchar()) != EOF )
		...

I know of no clearer expression of this common operation.



More information about the Comp.lang.c mailing list