Kaz Kylheku <> writes:
> On 2011-11-04, Ark <> wrote:
>> The fact that in
>> C (and descendants) the assignment operator is an expression is indeed
>> unfortunate and has lead to innumerable bugs stemming from clever
>> coding.
>
> This is the consequence of how the operator is spelled, not what kind
> of expression it is. Doh!
If assignment were a statement rather than an expression, then
accidental assignments like:
if (x = y) /* meant to write if (x == y) */
would be caught by the compiler. (Yes, compilers typically warn about
this.)
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"