我认为很多人不会认为 google c++ 规则是他们通常用来编写 c++ 代码的规则,例如“我们不使用 C++ 异常”。大多数人可能不会同意。
至于变量命名规则,它们看起来并没有什么问题。只要你有一些一致的规则,这并不重要。
I think that many people wouldn't consider the google c++ rules to be what they would use for writing c++ code in general, for example "We do not use C++ exceptions." is not something the majority would likely agree with.
As for the variable naming rules, they seem as good as any. It doesn't really matter as long as you have some consistant rule.
As you can see, CMemory is a common name and it could generate an ambiguity when the library is used, even if CMemory is under the namespace MyLib. Usually, do you use some prefix for classes, and other objects accessible with MyLib:: (for example: mlCMemory)?
No prefix. What would be the point of namespaces if you assume they don't do their job.
Note that Hungarian Notation (classnames begin with C) doesn't add much, and Google doesn't seem to be using it either.
发布评论
评论(3)
我认为很多人不会认为 google c++ 规则是他们通常用来编写 c++ 代码的规则,例如“我们不使用 C++ 异常”。大多数人可能不会同意。
至于变量命名规则,它们看起来并没有什么问题。只要你有一些一致的规则,这并不重要。
I think that many people wouldn't consider the google c++ rules to be what they would use for writing c++ code in general, for example "We do not use C++ exceptions." is not something the majority would likely agree with.
As for the variable naming rules, they seem as good as any. It doesn't really matter as long as you have some consistant rule.
是的,谷歌的命名约定看起来不错。
没有前缀。如果你认为命名空间不做他们的工作,那么它们还有什么意义呢?
请注意,匈牙利表示法(类名以 C 开头)并没有增加太多,而且 Google 似乎也没有使用它。
Yes, Google's naming convention seems fine.
No prefix. What would be the point of namespaces if you assume they don't do their job.
Note that Hungarian Notation (classnames begin with C) doesn't add much, and Google doesn't seem to be using it either.
我几年前读过这本书,不同意很多内容,而更喜欢其他风格和习语。
命名
个人而言,我使用
t_
表示类,使用 UpperCamel 表示命名空间:以及前缀
d_
表示成员变量。但该描述遗漏了我使用的许多其他约定。i read it a few years ago, and disagreed with a number of things, and preferred other styles and idioms.
Naming
personally, i use
t_
for classes and UpperCamel for namespaces:as well as the prefix
d_
for member variables. but that description leaves out many other conventions i use.