Introduction to C++

C++ programming language

The C++ programming language is a high-level, compiled, general-purpose programming language with static typing, suitable for creating a wide variety of applications. Today, C++ is one of the most popular and widely used languages.

Its roots lie in the C language, which was developed between 1969 and 1973 at Bell Labs by programmer Dennis Ritchie. In the early 1980s, Danish programmer Bjarne Stroustrup, who was working at Bell Labs at the time, developed C++ as an extension to C. In fact, at first, C++ simply supplemented C with some object-oriented programming features. That’s why Stroustrup himself initially referred to it as “C with classes.”

Subsequently, the new language began to gain popularity. New features were added, making it not just an addition to C but an entirely new programming language. Ultimately, “C with Classes” was renamed C++. Since then, the two languages ​​have developed independently.

The current language standard can be found at https://eel.is/c++draft/

C++ is a powerful language, inheriting C’s rich memory management capabilities. Therefore, C++ is often used in systems programming, particularly in the creation of operating systems, drivers, various utilities, antivirus software, and so on. Incidentally, the Windows OS is largely written in C++. However, the language’s applications are not limited to systems programming. C++ can be used in programs of any scale where speed and performance are important. It is often used to create graphical applications and various applications. It is also particularly popular for creating games with rich, visually rich graphics. Furthermore, mobile development has recently gained momentum, where C++ has also found its application. Even web development can use C++ to create web applications or auxiliary services that support web applications. Overall, C++ is a widely used language, suitable for creating virtually any type of program.

C++ is a compiled language, meaning that the compiler translates C++ source code into an executable file containing a set of machine instructions. However, different platforms have their own specificities, so compiled programs cannot simply be ported from one platform to another and run there. However, at the source code level, C++ programs are largely portable unless they use features specific to the current operating system. The availability of compilers, libraries, and development tools for almost all common platforms allows the same C++ source code to be compiled into applications for these platforms.

Unlike C, C++ allows for object-oriented programming, representing a program as a collection of interacting classes and objects. This simplifies the creation of large applications.

The main stages of development

In 1979-80, Bjarne Stroustrup developed an extension to the C language, “C with Classes.” In 1983, the language was renamed C++.

In 1985, the first commercial version of the C++ language was released, as well as the first edition of The C++ Programming Language, which was the first description of the language in the absence of an official standard.

In 1989, a new version of the C++ language, C++ 2.0, was released, which included a number of new features. After that, the language developed relatively slowly until 2011. However, in 1998, the first attempt to standardize the language was made by ISO (International Organization for Standardization). The first standard was called ISO/IEC 14882:1998, or C++98 for short. Subsequently, in 2003, a new version of the standard, C++03, was published.

In 2011, the new C++11 standard was published, which contained numerous additions and enriched the C++ language with a large number of new features. Since then, several more standards have been released. At the time of writing, the most recent standard, C++20, was published in December 2020. C++23 is expected to be released in 2023.

Compilers and development environments

To write programs in C++, you need at least two components: a text editor to type the source code, and a compiler to accept the source code file and compile it into an executable file. You can choose any text editor you like. I would recommend the cross-platform editor Visual Studio Code, which supports plugins for various languages, including C++.

While choosing a text editor is relatively straightforward—you can choose any—choosing a compiler can be a real challenge. There are currently many different compilers available, each differing in various aspects, particularly in their implementation of standards. A basic list of C++ compilers can be found on Wikipedia, and at https://en.cppreference.com/w/cpp/compiler_support, you can find information about compiler support for the latest standards. Generally, it’s often recommended to become familiar with at least three main compilers:

  • g++ from the GNU Project (as part of the GCC compiler suite)
  • Clang (available through the LLVM project)
  • Microsoft’s C++ compiler (used in Visual Studio)

We’ll look at some of them below. However, throughout this guide, we’ll focus primarily on the g++ compiler (GCC), developed by the GNU Project.

You can also use integrated development environments (IDEs) to create programs, such as Visual Studio, Netbeans, Eclipse, Qt, etc., which make it easier to create applications.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*