Brevity and obfuscation is basically for fun.
For work, clarity is much more important.
Code:
int foo ( int a, int b ) {
int c;
if ( a > b ) {
c = a;
} else {
c = b;
}
return c;
}
int bar ( int a, int b ) {
return a > b ? a : b;
}
With gcc at least, these produce identical optimised code
If it's obvious to you, then its obvious to the compiler as well.
Take this example
Code:
int foo ( int a, int b ) {
int t;
t = a;
a = b;
b = t;
printf( "%d %d\n", a, b );
}
int bar ( int a, int b ) {
a ^= b;
b ^= a;
a ^= b;
printf( "%d %d\n", a, b );
}
My compiler completely eliminates the swap in the former case, and just passes b,a to printf instead. All you've managed to do in the latter is confuse what is actually going on, so the compiler has to take the conservative approach and do what you asked.