According to the C ++ standard in [lex.icon], whole literals can be divided into 3 types: decimal literals, octal literals and hexadecimal literals, each of which can have a suffix for signess and length Type
Decimal literals must start with a non-zero digit, and octal literals start with 0, and hexadecimal literals have 0x and 0X, after the prefix (for octal literals and hexadecimal literals), any digit that is not represented in the corresponding base should cause a compilation error (for example, 09, which causes error C2041: illegal digit '9' for base '8' and in another prog.cpp:6:15: error: invalid digit "9" in octal constant compiler prog.cpp:6:15: error: invalid digit "9" in octal constant ), because if the integer literal is not representable, the program becomes poorly formed.
lccarrasco
source share