Notice that it says it has changed for C++, which is different from C.
>
> I guess that this is because otherwise y ? x=1 : x=2 would mean
> (y ? (x=1) : x) = 2.
>
> ?: is normally not l-value, but a gcc extension makes it an l-value when
> both arguments are. = is always l-value. Standard compiler would give an
Again, = does _not_ yield an l-value in C. Further, the ?: returning an
l-value is a C++ feature, and a gcc extension to C. So if you say it's an
extension, you're talking about C.
> error, but gcc, blindly following priorities and allowing the extension,
> would compile it the way that is not probably expected. So they swapped
> the priorities when = is on the right side of ?:.
they _did not_.
>
> other compilers older gcc newer gcc
>
> x=a?b:c x=(a?b:c) x=(a?b:c) x=(a?b:c)
>
> a?x=b:c a?(x=b):c a?(x=b):c a?(x=b):c
>
> a?b:x=c (a?b:x)=c (a?b:x)=c a?b:(x=c)
> SEMANTIC ERROR
>
> Although they use "incorrect" priorities here, they don't break correct
> programs.
>
-
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/