1、C+跨越40载的成功经验与未来演进Bjarne Stroustrup哥伦比亚大学BAbstract Why did C+succeed on a massive scale without marketing or a rich owner?Its imminent death was frequently predicted even from before it was called C+.The reason is that C+some key C+features serve widespread needs,are manageable by“ordinary developers
2、”,and stable over decades.Here,I will describe the role of classes with constructors and destructors,templates with concepts,and modules in contemporary C+.Also,I will briefly explain the plans for“Profiles”to manage the complexity accreted over decades of serious use.Along the way,Ill try to put th
3、e evolution of C+in its historical context.70 minutes+Q&AStroustrup-C+at 40-China 20257好的设计始于问题 我想构建一个分布式 Unix 系统 时间回到 1979 年 当时没有语言能满足我的所有需求 我需要高效的硬件操作 像 C 语言那样 还需要管理复杂性的抽象能力 像 Simula 语言那样 以及一个灵活的“强”静态类型系统 Stroustrup-C+at 40-China 20258Bjarne Stroustrup,摄于 1986核心理念:在代码中直接表达思想 示例 数学:张量,多项式 工程:矩阵,傅里叶
4、变换 图形学:着色,Gnome,路径 生物学:DNA序列,蛋白质 电信:缓冲区,通道 航空航天:电机,航线 汽车:车辆,汽车,行人 金融:金融工具,交易 计算机科学:映射,任务,图像,文件,边 并且要让其代价合理 唯一的限制是你的想象力 注:大多数优秀的软件都是无形的。Stroustrup-evolution-20249优秀的设计,基于合理的原则 灵活的静态类型系统 可扩展性 零开销 最少的显式类型转换 资源管理 防止泄漏 错误处理 提供保证 灵活的并发支持 不局限于一种风格Stroustrup-C+at 40-China 202510当代 C+能比以往任何早期的 C+更好地实现这些目标。好的
5、工具随需求而演进 为什么要演进?世界在变 问题在变 我们在变 优秀的工程依赖于反馈和改进 例如:泛型编程,编译期编程,模块“任何声称拥有完美语言的人,不是推销员就是愚人,或者两者兼有”Bjarne Stroustrup 1980年代起“即使是我也能设计出一门更漂亮的语言”Bjarne Stroustrup 1980年代起Stroustrup-C+at 40-China 202511稳定性与演进 稳定性:过去运行良好的代码,现在依然运行良好 演进:通常,我们今天可以做得更好 现实世界的进步:开发者如何跟上必要的变革?Stroustrup-C+at 40-China 202512C+生来就被设计为
6、持续演进的语言,其使用规模也在不断增长0100000020000003000000400000050000006000000198019851990199520002005201020152020展示 C+用户数量的粗略估计C+98exceptions,templates,the STL,Namespaces,C+11concurrency,lambdas,time,range-for,auto,constexpr,shared_ptr,tuple,regex,First commercial releasevirtual functions,iostreams,complex,const,o