Grokking convoluted expressions
Posted Mar 19, 2007 15:03 UTC (Mon) by
tjc (subscriber, #137)
In reply to:
Grokking convoluted expressions by ldo
Parent article:
Quotes of the week
For everybody else, I've put together this page. :)
A very useful page, but shouldn't the type cast operator be merged with the prefix unary group, instead of being in a group by itself? I can compile this without error with gcc 4.1.0:
int main()
{
double foo = 1.0;
~(int)foo;
return 0;
}
If the type cast operator has lower precedence than the bitwise one's complement operator, then the later should be evaluated first, and the compiler would produce the error "wrong type argument to bit-complement."
On the other hand, since these are both prefix operators and right-to-left associative, and if they both have the same precedence level, then the type cast will be evaluated first and there will be no error.
(
Log in to post comments)