[comp.lang.c] 'Possibly Incorrect Assignment' warnings from { obscure compiler }

flaps@dgp.toronto.edu (Alan J Rosenthal) (11/26/89)

>daveh@marob.masa.com (Dave Hammond) writes:
>> Should I change all such assignments to include an additional set of parens?

cpcahil@virtech.uucp (Conor P. Cahill) writes:
>This may or may not quiet the compiler, but it does nothing to assure the
>reader of the intended operator.

On the contrary, I've seen this exact practice recommended, here and elsewhere,
and now use it all the time.  I think a good way to think of it is that you
never directly test the assignment as an expression, but you can make it into a
more complicated expression in any way you like, including just parenthesizing
an extra level.

Putting in a "!= 0" is especially bad if the value is conceptually boolean,
because then you are using a double negative, which is always confusing.

ajr

--
"Learning algorithms from Knuth is almost as bad as learning physics from
 Newton in the Latin original."                     -- Jeffrey Kegler