且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

编译器概念问题

更新时间:2023-08-21 15:19:58

,因为要区分用作名称的数字和仅是数字的数字更加困难.它在很大程度上是历史性的,但规则是规则.还有上面您建议的表达式:
Because it is more difficult to distinguish between a number that is used as a name and a number that is just a number. It''s largely historical, but the rules are the rules. And an expression such as you suggest above:
int 9=10;


只是愚蠢.


is just plain stupid.


简单的答案是因为它违反了C语言规范"

原因很简单:它消除了混乱.如果您确实允许变量以数字开头怎么办?

The simple answer is "Because it is against the C language specification"

The reason why is pretty simple: it removes confusion. What if you did allow variables to start with numbers?

number = 1E6;

这是指1000000吗?还是尚未定义的名为"1E6"的变量?

Does this refer to 1000000? Or a variable called "1E6" that hasn''t been defined yet?