Skip to Content
C++语言导学(原书第2版)
book

C++语言导学(原书第2版)

by 本贾尼 斯特劳斯特鲁普
August 2021
Intermediate to advanced
450 pages
5h 35m
Chinese
Pearson
Content preview from C++语言导学(原书第2版)

16.1.4 标准和编程风格

一个标准描述了什么可以正确运作以及它们是如何运作的,但不会描述如何良好、有效地使用它们。能很好地理解编程语言特性的技术细节并不意味着能有效地将它们与其他特性、库和工具结合使用来构造更好的软件,两者之间存在巨大差异。“更好”的含义是“更易维护、更不易出错以及更快”。我们需要开发、普及并支持一致的编程风格。而且,我们必须为旧式代码向着这些更现代、更高效、更一致的风格进化提供支持。

随着语言和标准库的发展,普及有效编程风格的问题变得非常重要。很多程序员目前所采用的编程风格对某些任务很有效,让这么大的一个群体抛弃当前编程风格异常困难。现在还有人将C++当作C的一些微小补充,也还有人认为基于大量类层次的20世纪80年代的面向对象的编程风格是程序开发的顶峰。有很多人挣扎于在充斥大量旧式C++代码的环境中如何用好C++11。另一方面,也有很多人满腔热情地过度使用新特性。例如,有些程序员坚信只有使用了大量模板元编程的代码才是真正的C++。

什么是现代C++?在2015年,我开始着手设计一套以清晰缜密的基本原理支撑的编码指南,以期回答这个问题。很快我就发现我不是一个人在努力克服这个问题,而是在与来自世界很多地方的人们一起做这件事,特别是来自微软、红帽和脸书的技术人员,我们开始了“C++核心准则”(C++Core Guidelines)项目[Stroustrup,2015]。这是一个很有野心的项目,目标是为设计更简单、更快且更易维护的代码打下完善的类型安全和资源安全基础[Stroustrup,2016]。除了基本原理基础上的详细编码规则外,我们还开发了静态分析工具和一个小型的支持库作为这部指南的支撑。我认为,对于推动C++社区大规模地向着新的语言特性、库和支持工具前进,以期从它们的改进中受益这个目标而言,上述工作是至关重要的。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

软件开发实践:项目驱动式的Java开发指南

软件开发实践:项目驱动式的Java开发指南

Raoul-Gabriel Urma, Richard Warburton
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu

Publisher Resources

ISBN: 9787111633280