c++核心指南

作者:

这是一个持续改进中的活跃文档。它是一个开源项目,即将发布0.8版,这个项目的衍生成果,其复制,使用,修改,创作,都遵从MIT协议。为本项目做贡献时需要同意一份贡献者协议。详细请看附随的授权文件。我们将使“友好的用户”可以使用,复制,修改和衍生创作这个项目,希望得到建设性的意见。

改进的意见和建议是最受欢迎的。我们计划,一旦我们的理解提升了,或这个语言和有效的库改进了,就修改和扩展这个文档。当发表意见时,请留意我们的目标和总体方法的介绍。

前言

这个文档是用好C++的一系列指南。文档的目标是帮助人们更有效的使用现代C++。说“现代C++”指的是有效运用ISO C++标准(目前最新版本是 C++20,但绝大多数建议对 C++17、C++14、C++11 三个版本也是有效的)。换句话说,从现在开始,你希望你的代码在5年后看起来什么样?10年后呢?

The guidelines are focused on relatively high-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 might 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 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.

Many of 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. One way of thinking about these guidelines is as a specification for tools that happens to be readable by humans.

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

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值