CppCoreGuidelines README

The project's README from github.com/isocpp/CppCoreGuidelines. As one markdown file: README.md.

C++ Core Guidelines

"Within C++ is a smaller, simpler, safer language struggling to get out."
-- Bjarne Stroustrup

The C++ Core Guidelines are a collaborative effort led by Bjarne Stroustrup, much like the C++ language itself. They are the result of many person-years of discussion and design across a number of organizations. Their design encourages general applicability and broad adoption but they can be freely copied and modified to meet your organization's needs.

Getting started

The guidelines themselves are found at CppCoreGuidelines. The document is in GH-flavored MarkDown. It is intentionally kept simple, mostly in ASCII, to allow automatic post-processing such as language translation and reformatting. The editors maintain one version formatted for browsing. Note that it is manually integrated and can be slightly older than the version in the master branch.

The Guidelines are a constantly evolving document without a strict "release" cadence. Bjarne Stroustrup periodically reviews the document and increments the version number in the introduction. Checkins that increment the version number are tagged in git.

Many of the guidelines make use of the header-only Guidelines Support Library. One implementation is available at GSL: Guidelines Support Library.

Background and scope

The aim of the guidelines is to help people to use modern C++ effectively. By "modern C++" we mean C++11 and newer. In other words, what would you like your code to look like in 5 years' time, given that you can start now? In 10 years' time?

The guidelines are focused on relatively higher-level issues, such as interfaces, resource management, memory management, and concurrency. Such rules affect application architecture and library design. Following the rules will lead to code that is statically type-safe, has no resource leaks, and catches many more programming logic errors than is common in code today. And it will run fast -- you can afford to do things right.

We are less concerned with low-level issues, such as naming conventions and indentation style. However, no topic that can help a programmer is out of bounds.

Our initial set of rules emphasizes safety (of various forms) and simplicity. They may very well be too strict. We expect to have to introduce more exceptions to better accommodate real-world needs. We also need more rules.

You will find some of the rules contrary to your expectations or even contrary to your experience. If we haven't suggested that you change your coding style in any way, we have failed! Please try to verify or disprove rules! In particular, we'd really like to have some of our rules backed up with measurements or better examples.

You will find some of the rules obvious or even trivial. Please remember that one purpose of a guideline is to help someone who is less experienced or coming from a different background or language to get up to speed.

The rules are designed to be supported by an analysis tool. Violations of rules will be flagged with references (or links) to the relevant rule. We do not expect you to memorize all the rules before trying to write code.

The rules are meant for gradual introduction into a code base. We plan to build tools for that and hope others will too.

Contributions and LICENSE

Comments and suggestions for improvements are most welcome. We plan to modify and extend this document as our understanding improves and the language and the set of available libraries improve. More details are found at CONTRIBUTING and LICENSE.

Thanks to DigitalOcean for hosting the Standard C++ Foundation website.

CppCoreGuidelines (isocpp/CppCoreGuidelines)

Searching Database…

这是什么?C++ 核心指南是一套协作编写的 C++ 最佳实践规则,适用于编写现代 C++(C++11 及更高版本)代码,涵盖接口、资源管理、内存管理和并发等方面,目标是让代码类型安全、无内存泄漏且运行快速。
这是我需要安装的工具,还是只是一份用来阅读的文档?它是一份 Markdown 文档,不是软件。规则本身保存在本仓库的 CppCoreGuidelines 文件中,编辑者还维护了一个便于浏览的 HTML 版本。
我要怎样开始使用这些指南?打开 CppCoreGuidelines 文档(或便于浏览的编辑版本),通读各个规则章节;作者希望你逐步把规则引入自己的代码库,而不是一次全部引入。
遵循这些规则需要安装任何库吗?许多指南假定你使用纯头文件的 Guidelines Support Library(GSL),它有一个参考实现,也叫 GSL。
这些规则是最终定稿、固定不变的吗?不是。指南是一份持续演进的文档,没有严格的发布节奏;作者承认最初的规则可能过于严格,并计划随着时间推移增加更多例外情况。
这也适用于较早的 C++ 代码吗?指南针对的是“现代 C++”,即 C++11 及更新的版本;相比命名规范这类底层风格问题,它更关注高层架构和库设计方面的问题。
谁领导和维护这个项目?Bjarne Stroustrup 领导这项工作,它是多个机构历经多年(以人年计)讨论和设计的成果。
静态分析工具能根据这些规则检查我的代码吗?可以。这些规则在设计时就考虑了分析工具的支持,因此违规之处可以被标记,并附上指向相关规则的引用或链接。
我的公司能为内部使用调整这些指南吗?可以,这些指南可以自由复制和修改,以满足某个组织自身的需要。
为什么项目会提到 DigitalOcean?DigitalOcean 托管着 Standard C++ Foundation 的网站,而指南项目与该网站相关联。
Creator
isocpp
Size
25.7 MB
Stars
45.4K
Updated
CommitAug 06
Age
11y
Commits · 90 Days