repost to upset a C++ programmer:
int main() {
int a = 0xE + 1; // compiles
int b = 0xE+1; // doesn't
}
int main() {
int a = 0xE + 1; // compiles
int b = 0xE+1; // doesn't
}
Comments
cout << "Hello World";
return 0;
}
https://gcc.godbolt.org/z/z37enrcaP
C++17 introduced hex literals that can have exponents, but the key character there is "p" and not "e". The 0x implies that the tokeniser should not be treating it as a float until it meets a "." or a "p".
int a = 07; // compiles everywhere
int b = 08; // compiles in C# but not in C/C++
They unchained the complier writer from his padded cell. He looked at the few lines of code, and verbally compiled it down to machine code, identified the fix, and was taken back to his cell. 😱