C++ Language

Website Developer
7 min readOct 15, 2020

--

C++ is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language, or “C with Classes”.

History:

The C++ language is an object-oriented programming language & is a combination of both low-level & high-level language — a Middle-Level Language. The programming language was created, designed & developed by a Danish Computer Scientist — Bjarne Stroustrup at Bell Telephone Laboratories (now known as Nokia Bell Labs) in Murray Hill, New Jersey. As he wanted a flexible & dynamic language that was similar to C with all its features, but with active type checking, basic inheritance, default functioning argument, classes, in lining, etc. and hence C with Classes (C++) was launched.

The C++ programming language has a history going back to 1979 when Bjarne Stroustrup was doing work for his Ph.D. thesis. One of the languages Stroustrup had the opportunity to work with was a language called Simula, which as the name implies is a language primarily designed for simulations. The Simula 67 language — which was the variant that Stroustrup worked with — is regarded as the first language to support the object-oriented programming paradigm. Stroustrup found that this paradigm was very useful for software development, however, the Simula language was far too slow for practical use. Also, there are several versions of the C++ language, of which Visual C++ is only one. Other dialects include Borland C++, Turbo C++, and Code Warrior (Mac). All of these software packages enable you to create computer programs with C++, but they all implement the C++ language in a slightly different manner. In an attempt to maintain portability of both the C and C++ languages, the American National Standards Institute (ANSI) developed a standard of consistency for C and C++ programming. While we will be working primarily with this ANSI standard, we will also be examining the idiosyncrasies of Microsoft Visual C++ 6.0.

In 1998, the C++ standards committee published the first international standard for C++ ISO/IEC 14882:1998, which is informally known as C++98. The Standard Template Library, which began its conceptual development in 1979, was also included. In 2003, the committee responded to multiple problems that were reported with their 1998 standard and revised it accordingly. The changed language was named C++03.

In mid-2011, the new C++ standard (C++11) was finished. The new features included Regex support, a randomization library, a new C++ time library, atomics support, a standard threading library, a new for loop syntax providing functionality similar to for-each loops in certain other languages, the auto keyword, new container classes, better support for unions and array-initialization lists and variadic templates.

Platforms:

C++ is a compiled language, not an interpreted language. This means that you don’t run C++ directly; rather, on your development/build machine, you invoke the C++ compiler to generate an executable that targets a particular runtime platform, then — on the given platform — you take the executable that was generated and run it. It is also possible to semi-compile C++ like with Java (using, for example, the LLVM compiler to produce LLVM bytecode and then, on the target machine, completing the translation from bytecode to the final executable). With the right compiler, you can target almost any platform, though finding a compiler (and dealing with the idiosyncrasies of a given platform) may vary in difficulty depending on the platform.

To give some examples of platforms that C++ can be used with:

  • OSes: Linux, Windows, Mac OS X, Free BSD, other POSIX-compliant OSes
  • CPU Architectures: i386, PPC, IA32, IA64, Arm, etc.

Therefore, C++ cannot be run on any platform.
It’s the compiled machine code that runs on a platform.
So it depends on the compiler. If you can write a compiler that compiles C++ code to the native code on that platform, then it will run on that platform.

Benefits and downsides:

Advantages of C++

1. Portability

C++ offers the feature of portability or platform independence which allows the user to run the same program on different operating systems or interfaces at ease.

Suppose you write a program in LINUX OS and for some apparent reason you switch to Windows OS, you would be able to run the same program in windows as well without any error. This feature proves to be of great convenience to the programmer.

2. Object-oriented

One of the biggest advantages of C++ is the feature of object-oriented programming which includes concepts like classes, inheritance, polymorphism, data abstraction, and encapsulation that allow code re-usability and make a program even more reliable.

Not only this, it helps us deal with real-world problems by treating data as an object. C lacked this feature and hence it was created, proving to be of great significance.

This feature gave birth to numerous job prospects and technologies. It is fascinating to note that C++ was created by combining features not only from C but Simula 67, the first object-oriented programming language.

3. Multi-paradigm

C++ is a multi-paradigm programming language. The term “Paradigm” refers to the style of programming. It includes the logic, structure, and procedure of the program. Generic, imperative, and object-oriented are three paradigms of C++.

Let us now try to understand what generic programming means. Generic programming refers to the use of a single idea to serve several purposes. Imperative programming, on the other hand, refers to the use of statements that change a program’s state.

4. Low-level Manipulation

Since C++ is closely associated with C, which is a procedural language closely related to the machine language, C++ allows low-level manipulation of data at a certain level. Embedded systems and compiler are created with the help of C++.

5. Memory Management

C++ gives the programmer the provision of total control over memory management. This can be considered both as an asset and a liability as this increases the responsibility of the user to manage memory rather than it being managed by the Garbage collector. This concept is implemented with the help of DMA (Dynamic memory allocation) using pointers.

6. Large Community Support

C++ has a large community that supports it by providing online courses and lectures, both paid and unpaid. Statistically speaking, C++ is the 6th most used and followed tag on Stack Overflow and GitHub.

7. Compatibility with C

C++ is pretty much compatible with C. Virtually, every error-free C program is a valid C++ program. Depending on the compiler used, every program of C++ can run on a file with .cpp extension.

8. Scalability

Scalability refers to the ability of a program to scale. It means that the C++ program is capable of running on a small scale as well as a large scale of data. We can also build applications that are resource-intensive.

Disadvantages of C++

1. Use of Pointers

Pointers in C/C++ are a relatively difficult concept to grasp and it consumes a lot of memory. Misuse of pointers like wild pointers may cause the system to crash or behave anomalously.

2. Security Issue

Although object-oriented programming offers a lot of security to the data being handled as compared to other programming languages that are not object-oriented, like C, certain security issues still exist due to the availability of friend functions, global variables and, pointers.

3. Absence of Garbage Collector

As discussed earlier, C++ gives the user complete control of managing the computer memory using DMA. C++ lacks the feature of a garbage collector to automatically filter out unnecessary data.

4. Absence of Built-in Thread

C++ does not support any built-in threads. Threads is a relatively new concept in C++ which wasn’t initially there. Now, C++ is capable of supporting lambda functions.

The popularity of C++ in 2018

The TIOBE index looks at the popularity of various programming languages. This is determined by looking at the following variables: a number of skilled engineers in a particular language world-wide, courses offered in that language, and third-party vendors. This information is combined with popular search engine results for the different languages on Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube, etc., For April 2018, the same as April 2017, C++ was ranked as the 3rd most popular language.

Demand for C++ professionals is constant as it is used in so many different industries. One method of calculating demand for C++ professionals to analyze job data citing C++ as a requirement. C++ came in fourth in terms of IT jobs citing the language as a requirement, just behind JavaScript on Indeed, the world’s largest search engine for jobs. We have seen demand increase for C++ professionals for roles such a game software engineers, system software developers, and embedded engineers. There have been warnings that C++ will inevitably fade out of existence as technology and other languages continue to emerge. C++’s ability to run legacy code may no longer hold value in the future. However, we have seen employers favoring C++ as programmers can be more productive using a basic language that fits so many applications. The future is yet to be written for C++ but demand for and popularity of the language has stagnated since 2013 without any indications of this trend improving going forward.

--

--

Website Developer
Website Developer

No responses yet