c++-history
November 29, 2023

A Brief History of C++

Coding Standards
Functional Safety

MISRA C++:2023®, the next version of the MISRA C++ standard, is here! To help you prepare, we present the second installment of our MISRA C++:2023 blog series by Perforce Principal Technical Support Engineer, Dr. Frank van den Beuken. 

In this blog, we dive into the history of C++, how the programming language has evolved over the years, and where it's headed next. 

➡️ Read Part 1: Intro to MISRA C++:2023®

Training Courses for the NEW MISRA C++:2023 - Register today! 

Perforce is offering 2 training courses to choose from in January 2024 to ensure that you are fully prepared for the new guidelines. Register today! 

Introduction to MISRA C++:2023

MISRA C++:2023 for Safety-Critical Software Development

Read along or jump ahead to the section that interests you most: 

Back to top

Introduction: C++ History 

C++ is a much-used general purpose programming language with which highly efficient programs can be written. 

Because of that, it is also popular in safety-critical application areas such as those in the automotive industry, where MISRA is one of the most popular coding standards.

Let's take a look at the fascinating history of the language. 

Back to top

How C++ Began

C++ was invented by Danish computer scientist Bjarne Stroustrup at AT&T Bell Labs in 1979. It originated from analysis of the UNIX kernel to investigate to what extent it can be distributed over a network. 

While Stroustrup was working on his Ph.D thesis in the Computing Laboratory of Cambridge University, he was impressed by the program organization and concurrency features of the Simula programming language, which he used to write a simulator. However, he discovered that the implementation did not scale well, so eventually the simulator was rewritten in BCPL. 

Back to top

C with Classes 

For his work at AT&T Bell Labs, Stroustrup decided to enhance the C programming language with language features like those he found so useful in Simula. He started writing a pre-processor Cpre that converted C programs with Simula-like classes into regular C code that could be compiled with existing compilers. The new language was initially simply named, "C with Classes." 

From the start, the objective was that the new language could be used for everything that C could be used for, so that it was a general-purpose programming language. Also, because C compilers already were available for many platforms, it inherited C's portability, which to this day is one of its important quality attributes. Another objective of the language was to provide better alternatives for unsafe features of C, while maintaining its efficiency and direct access to underlying hardware features. 

C with Classes provided: 

  • Classes
  • Derived classes 
  • Public/private access control
  • Constructors and destructors 
  • Call and return functions (soon removed due to lack of popularity)
  • Friend classes 
  • Type checking of function arguments 
  • Inline functions 
  • Default arguments 
  • Overloading of the assignment operator. 
Back to top

C++ 

At this point in C++ history, the language needed a proper name. For some time, it had been called C84, but that was considered ugly and confusing. Eventually, it was computer scientist Rick Mascitti who suggested the name C++, which can be interpreted as the language being the successor of C. 

As more features were added to the language, the Cpre pre-processor was no longer suitable, and a proper compiler name Cfront was written. It still produced C code for convenience, but it was a proper compiler in that it performed a complete check of syntax and semantics as well as produced an internal representation of the program with one symbol table per scope. 

The new language features included: 

  • Virtual functions
  • Function name and operator overloading
  • References
  • Const
  • User-controlled free-store memory control
  • Improved type checking and C++ style comments (which were actually taken from BCPL). 

In 1986 the first revision of the "C++ Programming Language" book was published, describing the language according to the Cfront 1.0 compiler.

Back to top

C++ Release 2.0

The second version of the language was completed in 1989 and increased stability of its definition and implementation. 

C++ 2.0 added: 

  • Multiple inheritance 
  • Type-safe linkage
  • Improved resolution of overloaded functions
  • Recursive definition of assignment and initialization
  • Improved facilities for user-defined memory management
  • Abstract classes 
  • Static member functions
  • Const member functions
  • Protected members 
  • Overloading of operator -> and pointers to members. 
Back to top

C++ Release 3.0

This was the final C++ version before the language was standardized. C++ 3.0 was completed in 1991 and added class and function templates. There was supposed to be a C++ 4.0 release in 1993, adding exception handling for which an initial implementation was done by Hewlett-Packard in 1992, but it was never completed. 

Back to top

The Annotated C++ Reference Manual

AT&T plans for a new C++ compiler never materialized, while other C++ compilers, both commercial (including Borland, IBM, DEC, and Microsoft) and the open-source GNU compiler g++ emerged. As a result, the focus of Stroustrup shifted to developing and standardizing the language. The Annotated C++ Reference Manual, published in 1991, became the starting point for the language standard. The manual provided a complete definition of C++ instead of just the features implemented by Cfront 3.0, and was reviewed by many people from various organizations. The new features were namespaces, nested classes, and exception handling. 

Back to top

C++98

ANSI standardization of C++ was started in 1989 by Hewlett-Packard in conjunction with AT&T, DEC, and IBM. Standardizing the language became necessary for a few reasons: adding important new features, and preventing the development of incompatible dialects. In 1991 ISO standardization commenced, and since then the committees hold joint meetings. 

An important activity was the definition of the standard library, including the Standard Template Library (STL). Furthermore, it added:

  •  Real-time type information (RTTI: dynamic_cast, typeid)
  • Covariant return types
  • Cast operators 
  • Mutable
  • Bool
  • Declarations in conditions
  • Member templates
  • In-class member initializers
  • Separate compilation of templates (export)
  • Template partial specialization
  • Partial ordering of overload function templates. 
Back to top

C++03 and Embedded C++

C++03 was a maintenance release of C++98 amended with the corrections approved for the technical corrigendum. The committee had also started thinking about C++0x. 

Meanwhile, a consortium of Japanese embedded systems tools developers, including Toshiba, Hitachi, Fujitsu, and NEC, had proposed the Embedded C++ (EC++) subset. This was intended for embedded systems programming. The subset removed language features that could hurt performance or were perceived as too complicated for developers, and thus considered as productivity or correctness hazards. 

The banned features were multiple inheritance, templates, exceptions, RTTI, new-style casts and namespaces. Also, STL and locales were removed from the standard library and an alternative for iostreams was provided. Interestingly, EC++ has not been used a lot, and the "Ectended EC++" superset that added templates was more popular. 

In response to EC++, the committee released the Performance Technical Report. The Performance Technical Report provided a model of the time and space overhead implied by the use of various C++ language and library features. In doing so, it addressed concerns about performance problems. Furthermore, it presented techniques for efficient implementation. Consequently, the ISO committee did not endorse EC++. 

Back to top

C++11

This version introduced many new major features, so that for many programmers, it felt like a new language! 

C++11 added: 

  • Memory model
  • Concurrency
  • Auto and decltype 
  • Range-for
  • Move semantics and rvalue references
  • Uniform initialization
  • Nullptr
  • Constexpr functions
  • User-defined literals
  • Raw string literals
  • Attributes
  • Lambdas
  • Variadic templates
  • Template aliases (using)
  • Noexcept
  • Override and final
  • Static_assert
  • Long long
  • Default member initializers
  • Initialization in a constructor 
  • Enum classes. 

There were also major additions to the standard library. In 1998, the Boost organization was initiated, which provides free peer-reviewed portable C++ source libraries. The Boost library was important because various library features were available in it early, so that the ISO standard could benefit from the experience gained from their usage. The memory model was an important foundation for concurrency support, that provided threads and locks. 

Move semantics can improve efficiency because it eliminates unnecessary copies, which can be expensive for large objects. It completes the control of object lifetimes and resource management by allowing a developer to control if a resource is copied, or if its ownership should be transferred to another object. 

Back to top

C++14

The ISO C++ committee intended to have an alteration of major and minor releases, so that C++14 was aimed at completing C++11. It added: 

  • Binary literals (0b)
  • Digit separators
  • Variable templates
  • Function return type deduction
  • Generic lambdas
  • Local variables in constexpr functions
  • Move capture
  • Accessing a tuple by type 
  • User-defined literals in the standard library. 
Back to top

C++17

After the minor C++14 release, C++17 should have been a major update. Unfortunately some major expected features, such as concepts and coroutines, did not make it in this version. 

The new major features that did make it include: 

  • Class template argument deduction (introducing deduction guides)
  • Structured bindings
  • Inline variables 
  • Fold expressions
  • Explicit test in conditions
  • Guaranteed copy elision
  • Stricter expression evaluation order
  • Auto as a template argument type
  • Standard attributes to catch common mistakes
  • Hexadecimal floating-point literals
  • "if constexpr".

Some of the new features are exemplary for the increasing support for a functional programming style. The key element for that was already provided by lambdas in C++11, but fold expressions (a convenient notation to reduce a list of arguments to a single value using an operator) and deduction guides increase the functional flavor of the language.

Back to top

C++20

The major features that did not make it in C++17 were added in C++20. As a result, this version is a bigger step forward, comparable with the step from C++03 to C++11, so we can say that this version is the major upgrade that C++17 was supposed to be. 

The major new language features are: 

  • Coroutines
  • Concepts
  • Modules. 

Other new language features are compile-time computation support, spaceship operator <=>, concurrency improvements, designated initializers, and class types in non-type template parameters (also allowing string literals as template parameters). Furthermore, the new standard library features are ranges, date, span, and format. 

Modules finally provide a better way to express modularity than the pre-processor based, which include file mechanism inherited from C. Coroutines provide a stackless mechanism for asynchronous execution of sequential code. Concepts are named sets of requirements on template arguments and are part of the interface of a template. They make it possible to specify the intended use of templates and greatly improve clarity of compilation errors when a constraint is not satisfied. This is a significant improvement compared to the previous practice of using "Substitution Failure Is Not An Error" (SFINAE), which results in long and complex compilation errors when a constraint is violated. 

Back to top

The Future of C++

C++ has come a long way since the first steps in 1979 and continues to evolve. 

C++23 will soon be released with small but significant adjustments, and work has already begun on C++26. 

C++ continues to rise in popularity, and its use is expanding — including creating applications for virtual reality (VR) via the Unreal Engine, and also in cryptocurrency applications. 

Back to top

Trust Perforce Static Analysis for C++

Perforce's Static Analysis tools Helix QAC and Klocwork have been trusted for over 30 years for safe, secure, and high-quality code in C, C++, and more. Our tools identify defects, vulnerabilities, and compliance issues as you code, and are certified for use in safety-critical applications.

Helix QAC also provides Compliance Modules for the enforcement of the new MISRA C++:2023 guidelines. Perforce plans to have the full MISRA C++:2023 Compliance Module available on the release of the standard. 

See why Helix QAC is the best static code analyzer for MISRA C and MISRA C++.

➡️ Sign Up for a Free 7-Day Trial

Back to top