标识符名称中的数字没有问题吗? [英] Is there nothing wrong with digits in identifier name?
本文介绍了标识符名称中的数字没有问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因为在 C\C++\Java -
int 2a ;//整数常量上的后缀a"无效
变体名称的其余部分中的数字没有任何问题,尽管它是有效的语法吗?
Is there nothing wrong with digits in the rest of variant name although it's valid syntax ?
喜欢 -
int num1 ;
int num_1st ;
int num_2nd ;
推荐答案
我从未听说过任何人(例如,任何编码标准/指南)遇到标识符中的数字问题.尽管如此,它们中的太多可以表明向量或数组可能更可取——即使只有两个,你的 num_1st
和 num_2nd
可能是不如 numbers[2]
.
I've never heard of anybody (e.g., any coding standards/guidelines) that had a problem with digits in an identifier. Nonetheless, too many of them can indicate that a vector or array might be preferable -- even with only two, your num_1st
and num_2nd
might be better as numbers[2]
.
这篇关于标识符名称中的数字没有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文