29 ms·
From https://plg.uwaterloo.ca/~cforall/features https://plg.uwaterloo.ca/~cforall/features: Exponentiation Operator New binary exponentiation operator
by Someone 9y ago
From https://plg.uwaterloo.ca/~cforall/features https://plg.uwaterloo.ca/~cforall/features:
Exponentiation Operator
New binary exponentiation operator '\' (backslash)
for integral and floating-point types.
2 \ 8u; // integral result (shifting), 256
-4 \ 3u; // integral result (multiplication), -64
I hope that’s a documentation error. Otherwise, it seems designed for the “Obfuscated C for all” contest:
int i = f();
int j = i \ 3u;
Does what ‘\’ does really depend on the sign of i?
- Sean1708 9y agoThe "shifting" vs "multiplication" is just an optimisation since x * 2 == x << 1 for any positive x. As far as I'm aware shifting a negative number is undefined, which will be why they use multiplication for negatives.