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/archive/2011/05/12/Goole_Cpp_Style_Translation.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

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

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/25347

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月8日 上午3:12
下一篇 2023年2月8日 上午3:12

相关推荐