Which is more efficient in C ++

Photo by Taras Shypka on Unsplash

C ++ was developed in 1979 by developer Bjarne Stroustrup. As an extension of the C programming language, it has now been fully standardized by the ISO. It offers the possibility of machine-oriented and efficient programming. Programming on a high level of abstraction is also possible. There are different implementations within a standard library.

System programming and application programming possible

C ++ is used for system and application programming. The programming language is particularly well established in both areas, so developers are happy to fall back on it. Within system programming, the language is primarily used within operating systems, drivers, virtual machines, signal processors and embedded systems. Application programming benefits in particular from the programming language when the performance limits of technical framework conditions are to be used as efficiently as possible. However, application languages ​​such as Java or C # have pushed the programming language back from the domain.

The programming language is characterized by various properties

The approximately 60 keywords used can be used multiple times in different contexts. The real functionality is only given to C ++ by the standard library. The standard library teaches the language itself important functions. It also establishes a connection to the operating system. Additional frameworks and libraries can be used depending on the respective area of ​​application. The main focus of the programming language is the language resources for library development. General problem-solving mechanisms are preferred. Only a few individual solutions are integrated into the language. C ++ enables the combination of machine-oriented, efficient programming with various language elements. These language resources summarize complex and simple implementation details in order to then hide them behind abstract commands. Developers see this characteristic as a particular strength. Template metaprogramming is used in particular. This technology allows an almost uncompromising combination of abstraction and efficiency.

In C ++, variables and methods also belong to the interface. These are published within the header file. This property creates object dependencies on the locations used in runtime and compile time. However, these dependencies can be avoided through various constructions. For this it is necessary that Developer move the respective private fields of a class into a forward-declared, private auxiliary class.

Development of the programming language

The developer Stroustrup came up with the idea of ​​developing a new programming language through experience with Simula. Although Simula was suitable for large software projects, the language structure made it difficult to develop highly efficient programs. Correspondingly efficient programs could, however, be written with BCPL. However, BCPL was not suitable for large projects. With the help of his experience, Stroustrup expanded the programming language C, which was considered a multi-purpose language and also quickly produced code that could be ported to different platforms. Since C was part of the Unix operating system, the language was also quite widespread.

A class concept for the encapsulation of data is considered to be one of the first extensions. The primary model for this was the Simula-67 language. Only then did other classes and inline functions, a stricter type system and standard arguments follow.

Parallel to the development of CwithClasses, the developer also developed cfront. This is a compiler that generates C code from CwithClasses. It was not until 1983 that "CwithClasses" was renamed to C ++. The most important enhancements included:

  • Overload of operators and function names
  • virtual functions
  • Constants
  • credentials
  • a heap management that can be changed
  • an improvement in type checking
  • Comments linked to the end of the line (taken from BCPL)

In 1985 the first version of the programming language appeared. This version was an essential reference version because there was no standardization of the language at the time. Version 2.0 appeared in 1989. This made multiple inheritance, static member functions, abstract classes and constant member functions possible.