I need to create a class name starting with digits as 206xx.if it is possible to create then how to achieve this.
Asked
Active
Viewed 208 times
1 Answers
4
No, it is not possible. A valid identifier must begin with a non-digit character, and class names are identifiers.
To quote the standard, section 2.10:
identifier:
identifier-nondigit
identifier identifier-nondigit
identifier digit
identifier-nondigit:
nondigit
universal-character-name
other implementation-defined characters
nondigit: one of
a b c d e f g h i j k l m
n o p q r s t u v w x y z
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
digit: one of 0 1 2 3 4 5 6 7 8 9
An identifier is an arbitrarily long sequence of letters and digits. Each universal-character-name in an identifier shall designate a character whose encoding in ISO 10646 falls into one of the ranges specified in E.1. The initial element shall not be a universal-character-name designating a character whose encoding falls into one of the ranges specified in E.2. Upper- and lower-case letters are different. All characters are significant.
So, from the grammar above, we see that identifier-nondigit
must precede digit
in all derivations of identifier
. Hence, identifiers cannot start with digits.

Khoyo
- 1,253
- 11
- 20
-
Pointing out that/how the mentioned sections imply digit/alpha would top this off. – Yunnosch Jun 12 '19 at 06:02
-
-
You could also quote [lex.name](http://eel.is/c++draft/lex.name), which describes the grammar for an identifier. – Miles Budnek Jun 12 '19 at 06:03