Have you ever actually bothered to learn C or read the standards
documents? This isn't the first time you've demonstrated your
ignorance about fairly basic C behavior.
This is not a 'bug' that gcc fixes. All properly
standard-compliant C compilers behave this way because it is the
defined standard behavior for the assignment operator.
To quote the C Reference Manual (which is also the ANSI C
Standard document) in _The C Programming Language, Second
Edition_ by Kernighan and Ritchie:
A7.17 Assignment Expressions
There are several assignment operators; all group right-to-left.
assignment-expression:
conditional-expression
unary-expression assignment-operator assignment-expression
assignment-operator: one of
= *= /= %= += -= <<= >>= &= ^= |=
All require an lvalue as left operand, and the lvalue must be
modifiable: it must not be an array, and must not have an
incomplete type, or be a function. Also, its type must not be
qualified with const; if it is a structure or union, it must not
have any member or recursivly, submember qualified with const.
The type of an assignment expression is that of its left
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
operand, and the value is the value stored in the left operand
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
after the assignment has taken place.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
So an assignment expression does have a value, and consequently
can be legally used as a conditional expression in if, while, do,
or for statements.
In the future, Richard, please trouble yourself to do some real
research rather than treating your personal opinions as
incontrovertible facts.
-
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/