是否可以在 c++ 中创建以数字开头的类名
Is It possible to create class name starts with digits in c++
我需要创建一个以数字开头的类名作为206xx.如果可以创建那么如何实现这一点。
不,这是不可能的。有效的标识符必须以非数字字符开头,类名是标识符。
引用标准,第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
标识符是任意长的字母和数字序列。标识符中的每个通用字符名称应指定一个字符,其ISO 10646中的编码属于E.1中指定的范围之一。初始元素不应是通用字符名称,该名称指定其编码属于 E.2 中指定范围之一的字符。大写和小写字母不同。所有字符都很重要。
因此,从上面的语法中,我们看到identifier-nondigit
必须在digit
之前identifier
。因此,标识符不能以数字开头。
相关文章:
- 比较并显示使用最小值(a,b)和最大值(a、b)升序排列的4个数字
- 为什么随机数生成器不在void函数中随机化数字,而在main函数中随机化
- 检查输入是否不是整数或数字
- 如何(从固定列表中)选择一个数字序列,该序列将与目标数字相加
- 如何用数字处理log(0)
- 最高有效数字侧的第N位
- 如何获取一个数字的前3位
- 查找最接近的大于当前数字的数字的索引
- 找到两对数字,使它们的乘积的绝对差最小化
- 我想做一个彼此不同但重复出现的数字
- 将数字转换为字母(例如:123 转换为一二三)
- C++如何计算用户输入的数字中的偶数位数
- 开头C++:使用 if else,n--, 数字
- 是否可以在 c++ 中创建以数字开头的类名
- C++从文件中读取不同类型的数据,直到有一个以数字开头的字符串
- C++ 在数字开头添加小数点的任意方法
- 在以 8 开头的任何数字之前选择 "a" 或 "an"
- 如何阅读可能以字符串或数字开头的行
- 测试字符串是否以数字开头
- 如何在 ofn.lpstrFilter 中用数字开始文件格式名称?它不允许在开头写 3?