google c++ style guide (1) Naming 鸟人翻译

这里翻译Naming部分的内容,因为最近感觉自己程序中命名部分不太好,屡次修改,故而拜读一下google的经验,学习学习。

Naming

The most important consistency rules are those that govern naming. The style of a name immediately informs us what sort of thing the named entity is: a type, a variable, a function, a constant, a macro, etc., without requiring us to search for the declaration of that entity. The pattern-matching engine in our brains relies a great deal on these naming rules.

Naming rules are pretty arbitrary, but we feel that consistency is more important than individual preferences in this area, so regardless of whether you find them sensible or not, the rules are the rules.”

     最重要的一致性规则就是对于命名的掌控,命名可以帮助我们轻松愉快的读懂代码,分清类型,变量,函数,常量,宏,等等等。。而不必去前后翻页寻找相关初始定义。总之,存于心,见于行。

     命名规则当然是非常随意的囖,但是,在这块过于讲求个性不利于他人读懂你的代码,所以,讲讲规矩总是好事,你遵守或者不理睬,它就在那里,不悲不喜。。(肚子饿了。。)


原文地址:https://www.cnblogs.com/superniaoren/p/Goole_Cpp_Style_Translation.html