Google C++ Style:修订间差异
(创建页面,内容为“=== google cpp style === 无框 === google h style === 无框 分类:Develop 分类:C++”) |
无编辑摘要 |
||
(未显示同一用户的1个中间版本) | |||
第1行: | 第1行: | ||
C++ is one of the main development languages used by many of Google's open-source projects. As every C++ programmer knows, the language has many powerful features, but this power brings with it complexity, which in turn can make code more bug-prone and harder to read and maintain. | |||
The goal of this guide is to manage this complexity by describing in detail the dos and don'ts of writing C++ code . These rules exist to keep the code base manageable while still allowing coders to use C++ language features productively. | |||
''Style'', also known as readability, is what we call the conventions that govern our C++ code. The term Style is a bit of a misnomer, since these conventions cover far more than just source file formatting. | |||
Most open-source projects developed by Google conform to the requirements in this guide. | |||
Note that this guide is not a C++ tutorial: we assume that the reader is familiar with the language. | |||
=== google cpp style === | === google cpp style === | ||
[[文件:Google cpp style.png|无框]] | [[文件:Google cpp style.png|无框]] | ||
第4行: | 第14行: | ||
=== google h style === | === google h style === | ||
[[文件:Google h style.png|无框]] | [[文件:Google h style.png|无框]] | ||
=== using namespace std === | |||
有很多人不建议使用 using namespace std,还举了例子说很难区分其他比如自己写的函数到底是不是 std 中的。事实上,自己写的函数,应该有不同于 std 的命名空间,而且在使用的时候,要明显写出,如:udef::min()。 | |||
See also: https://google.github.io/styleguide/cppguide.html | |||
[[分类:Develop]] | [[分类:Develop]] | ||
[[分类:C++]] | [[分类:C++]] |
2024年10月16日 (三) 17:19的最新版本
C++ is one of the main development languages used by many of Google's open-source projects. As every C++ programmer knows, the language has many powerful features, but this power brings with it complexity, which in turn can make code more bug-prone and harder to read and maintain.
The goal of this guide is to manage this complexity by describing in detail the dos and don'ts of writing C++ code . These rules exist to keep the code base manageable while still allowing coders to use C++ language features productively.
Style, also known as readability, is what we call the conventions that govern our C++ code. The term Style is a bit of a misnomer, since these conventions cover far more than just source file formatting.
Most open-source projects developed by Google conform to the requirements in this guide.
Note that this guide is not a C++ tutorial: we assume that the reader is familiar with the language.
google cpp style
google h style
using namespace std
有很多人不建议使用 using namespace std,还举了例子说很难区分其他比如自己写的函数到底是不是 std 中的。事实上,自己写的函数,应该有不同于 std 的命名空间,而且在使用的时候,要明显写出,如:udef::min()。