I was expecting that in my following code:
#include
int main(){
int i = 10;
int j = 10;
j = ++(i | i);
printf(\"%d %d\\n\
You are right that it should not compile, and on most compilers, it does not compile.
(Please specify exactly which compiler/version is NOT giving you a compiler error)
I can only hypothesize that the compiler knows the identities that (i | i) == i
and (i & i) == i
and is using those identities to optimize away the expression, just leaving behind the variable i
.
This is just a guess, but it makes a lot of sense to me.