> That said, the problem with:
>
> if(a=b)
>
> is that the value of a is not tested. 'a' got assigned the value of
> 'b', but only the assignment was tested, not the resulting value.
Argh. No. No, no, no, no.
The value of 'a=b' is the value of 'b' (which is also the value of 'a' after
the assignment). What do you mean, the "assignment was tested"?
You'd expect
int a, b, c = 4;
a = b = c;
to work, just as well as a = ( b = c ), wouldn't you? It's *exactly* the
same thing. There's nothing magical about an if/else construct.
> This, as I explained over and over again, is called a
> "boolean test of assignment error". It is a real error because,
> unless the machine crashed, it is always TRUE. This is what
No, it's true only if the value being assigned is true. This is the way K&R
C works, the way ANSI C works, and the way ANSI C++ works. Any other standard
which works any other way is defining a different language, not C.
> Lint is complaining about. One needs to test the result.
The result _is_ tested. Show me any standard that thinks you're right. Or
any compiler for that matter.
> |_____ sequence point
Sequence points have sod all to do with this.
I do hope you don't write C code for anything critical. You don't seem
to be very familiar with the language.
Maybe you'd better stick to ADA. *sigh*
-- "His mind is like a steel trap -- full of mice"- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/