Um... Is it correct? I thought there was some rule about multiple
assignments to the same lvalue between sequence points.
I believe there is a sequence point after the evaluation of the lhs of
the ?: operator, but I don't know about after the evaluation of the rhs.
The expression may be undefined.
I can't think of any reasonable interpretation that would yield 2,
however...
(Is : alone an operator? Somewhere I remember it being a bitfield or
strange scoping operator. In that case, it may be interpreting it as
x = ((y) ? (x = ((1:x) = 2)));
which I could see interpreted as 2, in some bizzare sense.)
> I understand how ?: works. What I said was that gcc/egcc would not compile
> this line:
> x = (y) ? x = 1 : x = 2;
> But if you change it like this:
> x = (y) ? (x = 1) : (x = 2);
> then gcc/egcc don't give you an error. Try the same workaround in your own
> compiler, or upgrade it.
This makes it sound like some evaluation order misunderstanding.
>
> --Jeff
>
>
> -
> 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/
-- Buddha Buck bmbuck@acsu.buffalo.edu "Just as the strength of the Internet is chaos, so the strength of our liberty depends upon the chaos and cacaphony of the unfettered speech the First Amendment protects." -- A.L.A. v. U.S. Dept. of Justice
- 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/