2020-04-01-Cplusplus-History

本文回顾了C++的历史大事件,探讨了不同编译器如何逐步支持C++标准,特别是C++11的新特性。文章指出,由于C++标准的复杂性,各个编译器厂商在实现上存在差异,导致对某些特性支持的不完全。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

layouttitlecategoriestagsdescription
post
The history of C++
blog
C++
C++的发展历史

前言

在阅读C++相关的技术书籍或博客时,常常会提到一些日常开发中不常接触的名词,如cfront 2.0或者TR1等,这些名词在C++的历史发展中属于里程碑式的的名词。从C++不同时期的发展中可以看出对于程序员的开发需求逐渐满足,伴随着C++的标准的变化,编译器对语言的支持也逐渐完善。

C++ 历史大事件

关键事件总结

datefeaturedetailssample
1979首次实现引入类的CC with Classes first implemented
1. 新特性:类、成员函数、继承类、独立编译、公共和私有访问控制、友元、函数参数类型检查、默认参数、内联函数、赋值符号重载、构造函数、析构函数、f()相当于f(void)、调用函数和返回函数(同步机制,不是在C++中)
2. 库:并发任务程序库(不是在C++中)
1985编译器cfront 1.01. 新特性:虚函数、函数和操作符重载引用new和delete操作符const关键词、范围解析运算符::
2. 新加入的库:复数(complex)、字符串(string)、输入输出流(iostream)
1985《C++编程语言第一版》The C++ Programming Language, 1st edition
1989编译器cfront 2.01.新特性:多重继承、成员指针、保护访问控制、类型安全联接、抽象类、静态和常量成员函数、特定类的new和delete
2. 新库:I/O 操作器
1990ANSI C++委员会成立(ANSI C++ Committee founded)
1990《C++参考手册注解》The Annotated C++ Reference Manual was released.
1991ISO C++委员会成立(ISO C++ Committee founded)
1998C++981. 新特性:运行时类型信息[RTTI(dynamic_cast, typeid)]、协变返回类型(covariant return types)、cast 操作符、可变型、布尔型、声明情况、模板例示、成员模板、导出
2. 新库:容器、算法、迭代器、函数对象(STL中)、区域设置、位集合、值向量、自动指针(auto_ptr)、模块化字符串、输入输出流和复数
the C++ standards committee published the first international standard for C++ ISO/IEC 14882:1998, which would be informally known as C++98. The Annotated C++ Reference Manual was said to be a large influence in the development of the standard. The Standard Template Library, which began its conceptual development in 1979, was also included.
*****
1999Boost由委员会成员成立,旨在开发新的高质量库以作为标准库的候选库Boost founded by the committee members to produce new high-quality candidate libraries for the standard
2003C++03 (ISO/IEC 14882:2003)The committee responded to multiple problems that were reported with their 1998 standard, and revised it accordingly. The changed language was dubbed C++03. 这是一个次要修订版本,修正了一些错误。
2006Performance TR (ISO/IEC TR 18015:2006) (ISO Store ) (2006 draft )性能技术报告
20072007 Library extension TR1 (ISO/IEC TR 19768:2007) (ISO store ) (2005 draft )1. 源自Boost:引用包装器(Reference wrapper)智能指针(Smart pointers)、成员函数(Member function)、Result of 、绑定(Binding)、函数(Function)、类型特征(type traits)、随机(Random)、数学特殊函数(Mathematical Special Functions)、元组(Tuple)、数组(Array)、无序容器[Unordered Containers包括哈希(Hash)]还有正则表达式(Regular Expressions)
2. 源自C99:math.h中同时也是新加入C99的数学函数、空白字符类、浮点环境(Floating-point environment)、十六进制浮点I/O操作符(hexfloat I/O Manipulator)、固定大小整数类型(fixed-size integral types)、长整型(the long long type)、va_copy、snprintf() 和vscanf()函数族,还有C99 的printf()与scanf()函数族的指定转换。 TR1除了一些特殊函数,大部分都被囊括进C++11。
*****
2010数学特殊函数技术报告[2010 Mathematical special functions TR (ISO/IEC 29124:2010)(ISO Store)]此TR是一个C++标准库扩展,加入了TR1中的部分特殊函数,但那些函数之前没有被包括进C++11:椭圆积分、指数积分、拉盖尔多项式(Laguerre polynomials)、勒让徳多项式(Legendre polynomials)、艾尔米特多项式(Hermite polynomials)、贝塞尔(Bessel)函数、纽曼(Newmann)函数、$\beta$函数和黎曼(Riemann)$\zeta$函数
2011C++11 (ISO/IEC 14882:2011) (ISO Store) (ANSI Store )1. 新语言特性:自动(auto)和类型获取(decltype)、默认和已删除函数(defaulted and deleted functions)、不可更改(final)和重载(override)拖尾返回类型(trailing return type)右值引用(rvalue references)移动构造函数(move constructors)/移动赋值(move assignment)、作用域枚举(scoped enums)、常量表达式(constexpr)和文字类型(literal types)、列表初始化(list initialization)、授权(delegating)和继承构造器(inherited constructors)、大括号或等号(brace-or-equal)初始化器、空指针(nullptr)、长整型(long long)、char16_t和char32_t、类型别名(type aliases)、可变参数模板(variadic templates)、广义联合体(generalized unions)、广义POD、Unicode字符串文字(Unicode string literals)、自定义文字(user-defined literals)、属性(attributes)、$\lambda$表达式(lambda expressions)、无异常(noexcept)、对齐查询(alignof)和对齐指定(alignas)、多线程内存模型(multithreaded memory model)、线程本地存储(thread-local storage)GC接口(GC interface)、range for(based on a Boost library)、静态断言[static assertions(based on a Boost library)]
2.新库特性:原子操作库(atomic operations library)、**emplace()**和贯穿整个现有库的右值引用的使用、std::initializer_list、状态性的和作用域内的分配器(stateful and scoped allocators)、前向列表(forward_list)、计时库(chrono library)、分数库(ratio library)、新算法(new algorithms)、Unicode conversion facets
3.源自TR1:除了特殊的函数,TR1中全部都被囊括进来
4.源自Boost:线程库(The thread library)、异常指针(exception_ptr)、错误码(error_code)和错误情况(error_condition)、迭代器改进[iterator improvements(std::begin, std::end, std::next, std::prev)]
5.源自C:C风格的Unicode转换函数
6.搜集错误报告修复:363个错误在2008草案中被解决,另外有322个错误接着被修复。其中的错误包括530号,它使得std::basic_string对象相连。
*****
2011十进制浮点技术报告[Decimal floating-point TR (ISO/IEC TR 24733:2011) (ISO Store ) (2009 draft )]这个TR根据IEEE 754-2008浮点算数标准(Floating Point Arithmetic):std::decimal::decimal32、std::decimal::decimal64、std::decimal::decimal128
2012标准C++基金会成立The Standard C++ Foundation founded
2013《C++编程语言第四版》The C++ Programming Language, 4th edition
2014C++14 (2014 final draft )1. 新语言特性:变量模板(variable templates)、多态lambda(polymorphic lambdas)、λ动捕获(move capture for lambdas)、new/delete elision、常量表达式函数放宽限制(relax restrictions on constexpr functions)、二值文本(binary literals)、数字分隔符(digit separators)、函数返回类型推演(return type deduction for functions)、用大括号或等号初始符集合初始化类
2. 新库特性:std::make_unique、std::shared_mutex和std::shared_lock、std::index_sequence、std::exchange、std::quoted,还有许多针对现有库的小改进,比如一些算法的双距离重载(two-range overloads for some algorithms)、类型特征的类型别名版本(type alias versions of type traits)、用户定义字符串(user-defined string)、持续期(duration)和复杂数字文本(complex number literals)等等
3.搜集错误报告修复:149号库(149 library issues) 基础库技术规范(Library fundamentals TS), 文件系统技术规范(Filesystem TS)和其他专业技术规范( experimental technical specifications)

不同编译器对c++标准的支持

cfront x.x就是Bjarne Stroustrup的第一个C++编译器,将C++转换成C语言。在1993年,cfront 4.0因为尝试支持异常机制失败而被取消。我们开发者最长打交道的工具就是编译器了。我们只要通过编写程序语言,编译器会翻译成具体的更底层命令来控制计算机去实现我们的需要的功能。但C++语言标准是一个庞大的特性集合,而不同编译器厂商在根据这个统一标准做编译器的过程中,由于各种原因,不可能支持全部的标准中列举出来的特性。 例如,C++11已经流行多年,很多特性是随着编译器版本release才逐渐支持的,如下图:

参考资料

//########################################################################### // // FILE: F2806x_PieVect.h // // TITLE: F2806x Devices PIE Vector Table Definitions. // //########################################################################### // $TI Release: F2806x C/C++ Header Files and Peripheral Examples V136 $ // $Release Date: Apr 15, 2013 $ //########################################################################### #ifndef F2806x_PIE_VECT_H #define F2806x_PIE_VECT_H #ifdef __cplusplus extern "C" { #endif //--------------------------------------------------------------------------- // PIE Interrupt Vector Table Definition: // // Create a user type called PINT (pointer to interrupt): typedef interrupt void(*PINT)(void); // Define Vector Table: struct PIE_VECT_TABLE { // Reset is never fetched from this table. // It will always be fetched from 0x3FFFC0 in // boot ROM PINT PIE1_RESERVED; PINT PIE2_RESERVED; PINT PIE3_RESERVED; PINT PIE4_RESERVED; PINT PIE5_RESERVED; PINT PIE6_RESERVED; PINT PIE7_RESERVED; PINT PIE8_RESERVED; PINT PIE9_RESERVED; PINT PIE10_RESERVED; PINT PIE11_RESERVED; PINT PIE12_RESERVED; PINT PIE13_RESERVED; // Non-Peripheral Interrupts: PINT TINT1; // CPU-Timer1 PINT TINT2; // CPU-Timer2 PINT DATALOG; // Datalogging interrupt PINT RTOSINT; // RTOS interrupt PINT EMUINT; // Emulation interrupt PINT NMI; // Non-maskable interrupt PINT ILLEGAL; // Illegal operation TRAP PINT USER1; // User Defined trap 1 PINT USER2; // User Defined trap 2 PINT USER3; // User Defined trap 3 PINT USER4; // User Defined trap 4 PINT USER5; // User Defined trap 5 PINT USER6; // User Defined trap 6 PINT USER7; // User Defined trap 7 PINT USER8; // User Defined trap 8 PINT USER9; // User Defined trap 9 PINT USER10; // User Defined trap 10 PINT USER11; // User Defined trap 11 PINT USER12; // User Defined trap 12 // Group 1 PIE Peripheral Vectors: PINT ADCINT1; // ADC - if Group 10 ADCINT1 is enabled, this must be rsvd1_1 PINT ADCINT2; // ADC - if Group 10 ADCINT2 is enabled, this must be rsvd1_2 PINT rsvd1_3; PINT XINT1; // External Interrupt 1 PINT XINT2; // External Interrupt 2 PINT ADCINT9; // ADC 9 PINT TINT0; // Timer 0 PINT WAKEINT; // WD // Group 2 PIE Peripheral Vectors: PINT EPWM1_TZINT; // EPWM-1 PINT EPWM2_TZINT; // EPWM-2 PINT EPWM3_TZINT; // EPWM-3 PINT EPWM4_TZINT; // EPWM-4 PINT EPWM5_TZINT; // EPWM-5 PINT EPWM6_TZINT; // EPWM-6 PINT EPWM7_TZINT; // EPWM-7 PINT EPWM8_TZINT; // EPWM-8 // Group 3 PIE Peripheral Vectors: PINT EPWM1_INT; // EPWM-1 PINT EPWM2_INT; // EPWM-2 PINT EPWM3_INT; // EPWM-3 PINT EPWM4_INT; // EPWM-4 PINT EPWM5_INT; // EPWM-5 PINT EPWM6_INT; // EPWM-6 PINT EPWM7_INT; // EPWM-7 PINT EPWM8_INT; // EPWM-8 // Group 4 PIE Peripheral Vectors: PINT ECAP1_INT; // ECAP-1 PINT ECAP2_INT; // ECAP-2 PINT ECAP3_INT; // ECAP-3 PINT rsvd4_4; PINT rsvd4_5; PINT rsvd4_6; PINT HRCAP1_INT; // HRCAP-1 PINT HRCAP2_INT; // HRCAP-2 // Group 5 PIE Peripheral Vectors: PINT EQEP1_INT; // EQEP-1 PINT EQEP2_INT; // EQEP-2 PINT rsvd5_3; PINT HRCAP3_INT; // HRCAP-3 PINT HRCAP4_INT; // HRCAP-4 PINT rsvd5_6; PINT rsvd5_7; PINT USB0_INT; // USB-0 // Group 6 PIE Peripheral Vectors: PINT SPIRXINTA; // SPI-A PINT SPITXINTA; // SPI-A PINT SPIRXINTB; // SPI-B PINT SPITXINTB; // SPI-B PINT MRINTA; // McBSP-A PINT MXINTA; // McBSP-A PINT rsvd6_7; PINT rsvd6_8; // Group 7 PIE Peripheral Vectors: PINT DINTCH1; // DMA CH1 PINT DINTCH2; // DMA CH2 PINT DINTCH3; // DMA CH3 PINT DINTCH4; // DMA CH4 PINT DINTCH5; // DMA CH5 PINT DINTCH6; // DMA CH6 PINT rsvd7_7; PINT rsvd7_8; // Group 8 PIE Peripheral Vectors: PINT I2CINT1A; // I2C-A PINT I2CINT2A; // I2C-A PINT rsvd8_3; PINT rsvd8_4; PINT rsvd8_5; PINT rsvd8_6; PINT rsvd8_7; PINT rsvd8_8; // Group 9 PIE Peripheral Vectors: PINT SCIRXINTA; // SCI-A PINT SCITXINTA; // SCI-A PINT SCIRXINTB; // SCI-B PINT SCITXINTB; // SCI-B PINT ECAN0INTA; // eCAN-A PINT ECAN1INTA; // eCAN-A PINT rsvd9_7; PINT rsvd9_8; // Group 10 PIE Peripheral Vectors: PINT rsvd10_1; // Can be ADCINT1, but must make ADCINT1 in Group 1 space "reserved". PINT rsvd10_2; // Can be ADCINT2, but must make ADCINT2 in Group 1 space "reserved". PINT ADCINT3; // ADC PINT ADCINT4; // ADC PINT ADCINT5; // ADC PINT ADCINT6; // ADC PINT ADCINT7; // ADC PINT ADCINT8; // ADC // Group 11 PIE Peripheral Vectors: PINT CLA1_INT1; // CLA PINT CLA1_INT2; // CLA PINT CLA1_INT3; // CLA PINT CLA1_INT4; // CLA PINT CLA1_INT5; // CLA PINT CLA1_INT6; // CLA PINT CLA1_INT7; // CLA PINT CLA1_INT8; // CLA // Group 12 PIE Peripheral Vectors: PINT XINT3; PINT rsvd12_2; PINT rsvd12_3; PINT rsvd12_4; PINT rsvd12_5; PINT rsvd12_6; PINT LVF; // Latched overflow PINT LUF; // Latched underflow }; //--------------------------------------------------------------------------- // PIE Interrupt Vector Table External References & Function Declarations: // extern struct PIE_VECT_TABLE PieVectTable; #ifdef __cplusplus } #endif /* extern "C" */ #endif // end of F2806x_PIE_VECT_H definition //=========================================================================== // End of file. //=========================================================================== /*===================================================================================== File name: sysInit.c Originator: Motor Control Systems Group Description: ===================================================================================== History: ------------------------------------------------------------------------------------- 04-15-2005 Version 3.20 -------------------------------------------------------------------------------------*/ #ifndef _SYSINIT_C #define _SYSINIT_C #include "pmsmahf.h" // These are defined by the linker (see F2812.cmd) extern Uint16 RamfuncsLoadStart; extern Uint16 RamfuncsLoadEnd; extern Uint16 RamfuncsRunStart; /*=====================================================================================*/ /**/ /*=====================================================================================*/ void fun_sysInit() { // ****************************************** // Initialization code for DSP_TARGET = F2812 // ****************************************** // Initialize System Control registers, PLL, WatchDog, Clocks to default state: // This function is found in the DSP281x_SysCtrl.c file. InitSysCtrl(); /* // Globally synchronize all ePWM modules to the time base clock (TBCLK) EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1; EDIS; // HISPCP prescale register settings, normally it will be set to default values EALLOW; // This is needed to write to EALLOW protected registers SysCtrlRegs.HISPCP.all = 0x0000; // SYSCLKOUT/1 EDIS; // This is needed to disable write to EALLOW protected registers */ // Disable and clear all CPU interrupts: DINT; IER = 0x0000; IFR = 0x0000; // Initialize Pie Control Registers To Default State: // This function is found in the DSP281x_PieCtrl.c file. InitPieCtrl(); // Initialize the PIE Vector Table To a Known State: // This function is found in DSP281x_PieVect.c. // This function populates the PIE vector table with pointers // to the shell ISR functions found in DSP281x_DefaultIsr.c. InitPieVectTable(); // Copy time critical code and Flash setup code to RAM // This includes the following ISR functions: EvaTimer1(), EvaTimer2() // EvbTimer3 and and InitFlash(); // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart // symbols are created by the linker. Refer to the F2812.cmd file. MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart); // Call Flash Initialization to setup flash waitstates // This function must reside in RAM InitFlash(); // User specific functions, Reassign vectors (optional), Enable Interrupts: // Waiting for enable flag set // Enable CNT_zero interrupt using EPWM1 Time-base EALLOW; // This is needed to write to EALLOW protected registers EPwm1Regs.ETSEL.bit.INTEN = 1; // Enable EPWM1INT generation EPwm1Regs.ETSEL.bit.INTSEL = 1; // Enable interrupt CNT_zero event EPwm1Regs.ETPS.bit.INTPRD = 1; // Generate interrupt on the 1st event EPwm1Regs.ETCLR.bit.INT = 1; // Enable more interrupts #if HD_PHASE_OC_SOURCE==HD_PHASE_OC_HARDWARE EPwm1Regs.TZEINT.bit.OST = 1; // Enable EPWM1_TZINT generation #else EPwm1Regs.TZEINT.bit.OST = 0; // Disable EPWM1_TZINT generation #endif EPwm1Regs.TZCLR.bit.OST = 1; // Enable more interrupts EPwm1Regs.TZCLR.bit.CBC = 1; // Enable more interrupts EPwm1Regs.TZCLR.bit.INT = 1; // Enable more interrupts EDIS; // This is needed to disable write to EALLOW protected registers // Reassign ISRs. // Reassign the PIE vector for T1UFINT and CAP3INT to point to a different // ISR then the shell routine found in DSP281x_DefaultIsr.c. // This is done if the user does not want to use the shell ISR routine // but instead wants to use their own ISR. EALLOW; // This is needed to write to EALLOW protected registers PieVectTable.EPWM1_INT = &MainISR; #if HD_PHASE_OC_SOURCE==HD_PHASE_OC_HARDWARE PieVectTable.EPWM1_TZINT = &PdpintISR; #endif EDIS; // This is needed to disable write to EALLOW protected registers // Enable PIE group 3 interrupt 1 for EPWM1_INT PieCtrlRegs.PIEIER3.all = M_INT1; // Enable PIE group 2 interrupt 1 for EPWM1_TZINT PieCtrlRegs.PIEIER2.all = M_INT1; // Enable CPU INT3 for EPWM1_INT: IER |= (M_INT2 | M_INT3); // Initialize scia: /*#if PRODUCT_TYPE_ID==PRODUCT_TYPE_DRIVER_HZ gpioReg.init_HC(&gpioReg); #else*/ gpioReg.init(&gpioReg); //#endif sciCom1.LspClk = ((Uint32)SYSTEM_FREQUENCY*1000000/4); sciCom1.ComNo = SCI_COM1;//usb sciCom1.BaudRate = 9600; sciCom1.init(&sciCom1); // sciCom2.LspClk = ((Uint32)SYSTEM_FREQUENCY*1000000/4); // sciCom2.ComNo = SCI_COM2;//485 // sciCom2.BaudRate = 19200; // sciCom2.init(&sciCom2); fun_errorInit(); fun_ioSignalInit(); fun_dbCtrlInit(); fun_adInit(); fun_eepromInit(); fun_saveRomInit(); ////////////////// fun_machineLockInit(); fun_intfDataInit(); fun_internParaInit(); fun_timerInit(); // fun_masterEncInit(); fun_fanCtrl_init(); fun_sysCtrlInit(); fun_motorDriveInit(); fun_MODBUS_Init(&sciCom1); fun_overLoadInit(); fun_mtAngleOriginInit(); fun_mtoffsetTestInit(); // fun_mtoffsetTestHallInit(); fun_mtAngleInit(); fun_mtCtrlModInit(); fun_dataLogInit(); fun_trqSeltInit(); fun_spdSeltInit(); fun_posSeltInit(); fun_udcSeltInit(); fun_posGenInit(); fun_speedInit(); // fun_appCtrlEMPInit(); fun_mtCtrl_fsm_Init(); fun_appCtrlInit(); fun_runLedInit(); // fun_mtDriveOnInit(); fun_chargCtrlInit(); // fun_appCompInit(); // fun_appDensityInit(); fun_tmpMd_Init(); // fun_appTsn_init(); fun_ad_offsetCheck(); // encoder_para_init(); fun_appCtrl_fsm_Init(); fun_appCtrl_fsm_para_Init(); DI_init(); DI_para_init(); DO_led_init(); DO_init(); encoder_para_init(); //必须在fun_mtEnc_init()之后 error_init_withoutEeprom(); error_init_withEeprom(); production_init(); weftSens_init(); weftSens_para_init(); fun_phaseLackInit(); // fun_testParInit(); fun_fuzzyPIDInit(); // EvaRegs.T1CON.bit.TENABLE = 1; // Enable global Interrupts and higher priority real-time debug events: EnableDog(); EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM } #endif 为什么会触发PdpintISR()这个中断函数
最新发布
07-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值