paint-brush
Modern C and C++: Important Facts To Knowby@PavanBelagatti
1,849 reads
1,849 reads

Modern C and C++: Important Facts To Know

by Pavan BelagattiMarch 9th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

C and C++ are still the Go-to languages for new projects in Smart and Autonomous Cars, Space exploration, robotics and even completely new projects and tech are being written in C++. C is flexible as it gives more control for programmers by allowing them to manipulate bits, bytes, and addresses, and this helps the program to behave exactly how the program would want it to behave. C has a great history where it was created, influenced, and field-tested by working programmers in all areas.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Modern C and C++: Important Facts To Know
Pavan Belagatti HackerNoon profile picture

C was developed and promoted by Dennis Ritchie in the years between 1969 and 1973 at AT&T Bell Labs. C++ came into existence around 1979 by Bjarne Stroustrup. C++ was created as an enrichment to the C programming language, and initially, it was named "C with Classes."

C and C++ rule the world, still with being the base languages for other modern languages. It is essential for any developer to learn C and C++ as their first programming language as they carry the legacy and a strong history that no other programming language has yet. To improve basic programming skills and interpretation of how basic programming works, the knowledge of C and C++ is proven to be very essential. 

In embedded systems, 3D software, IoT, databases, etc, still C and C++ rocks as solid languages. C and C++ are still the Go-to languages also for new projects in Smart and Autonomous Cars, Space exploration, robotics and even completely new projects and tech are being written in C++. The reason to write these in C and C++ is since applications need to be very efficient and fast as they handle a huge amount of data and do many calculations per second.

The popularity of C 

C is a very mature language that has been around for years now. 

The C language is often called a middle-level computer language as it gives a good balance of both high level and low-level languages. C is flexible as it gives more control for programmers by allowing them to manipulate bits, bytes, and addresses, and this helps the program to behave exactly how the program would want it to behave, and it gives more direct access to the mechanics of the underlying hardware.

C has a great history where it was created, influenced, and field-tested by working programmers in all areas. The objective of any programmer choosing C is because it gives the programmer what the programmer wants.

The one important feature of C is the ability to implement various data types, unions, arrays, loops, macros, functions, structures, user-defined operations, binary trees, hash tables, linked lists, stacks, and queues, and pointers. C as a language serves as a prerequisite for learning other more modern programming languages. The C standard library provides programmers with a remarkable range of inbuilt functions that eases out things during programming. 

The American National Standards Institute (ANSI) established a board in 1983 named X3J11, to develop a standard specification of C language.

In 1990, the ANSI C standard was adopted by the International Organization for Standardization (ISO) as ISO/IEC 9899:1990, which is sometimes also termed C90. Therefore, the terms "C89" and "C90" refer to the same programming language.

C18 is regarded as the unofficial name for ISO/IEC 9899:2018, the most up-to-date standard for the C language, issued in June 2018. It replaced the previous C11 (standard ISO/IEC 9899:2011). It has been informally named as C17 also. C2x will succeed C18.

The popularity of C++

C++ is everywhere if we look around. From IoT to Database software, Embedded systems, operating systems, medical applications, and games are a few real-world cases that use C++. Recently, as processors have grown more powerful than ever with tech advancements and the application scene has taken on additional challenging requirements in the software and automotive industry, C++ has witnessed a sudden increase in its usage for IoT solutions.

The reason is, C++ provides higher performance, flexibility, by consuming less energy, thereby making it ideal for small devices that can’t by themselves maintain high activity levels and energy potentials due to limited power capabilities. C++ allows and gives the programmer control over things in the hardware systems, like control over intimate hardware details without dropping to the level of assembly language.

C++ is so reliable and popular that even SpaceX uses C++ for its rockets.

C++ is standardized by ISO (The International Standards Organization) along with national standards organizations, such as BSI (The British Standards Institute), ANSI (The American National Standards Institute), DIN (The German national standards organization). The original C++ standard was announced in 1998, a minor revision in 2003, and a significant update, C++11, was issued in September 2011, and the C++14 C++14 was released on December 15, 2014. C++17 - as of 2019, this is the most recent revision.

Currently, the standards committee has completed its work to produce a new standard, a major revision, in 2020: C++20, this standard got technically finalized by WG21 at the meeting in Prague in February 2020. The standard is anticipated to be officially published after the end of May 2020.

According to HackerRank’s 2019 Developer Skills Report, C and C++ are still the most demanding languages that developers want to learn.

According to TIOBE’s survey, C and C++ are still the most popular and most used languages overall among developers.

C and C++ power the world 

  • When it comes to Java, the core of Java Virtual Machine hotspot, a Java virtual machine for desktop and server computers, is implemented in C++.
  • In Python, the Python interpreter itself is implemented in C, and this shows the power of C language. 
  • The most successful Javascript engine V8 is implemented in C++. V8 is Google's open-source high-performance JavaScript and WebAssembly engine. 
  • One of the most famous scientific libraries in Python, Numpy, which is widely used in AI and ML, and its core module is implemented in C. Other popular AI things like TensorFlow are written in C++, though typically accessed by a python Layer. Computer Vision (OpenCV is C++) is also written in C++, then other languages like python wrap it.
  • Chrome, Firefox, etc., which are regarded as modern and powerful browsers, are written in C/C++.
  • Even the most operating system kernels for Linux, Android, Windows, Mac, iOS, and so on are written in C.
  • C/C++ power the modern high performing games like Unreal Engine, Unity3D, cocos2d-x, etc. and people love these games. 
  • Many other programming languages interpreters and compilers are also written and implemented based on C and C++.

C and C++ tooling

The language has evolved a lot, especially modern C++ is a wildly different language. C++ has added a lot of newer features in the latest versions of the language. Check out this fantastic repository on modern C++ which is named Awesome Modern C++.

Modern C++ is very performance oriented, that’s the reason why C++ is popular in the Video Game and Banking industries, both of which need breakneck speed and efficient resource usage.

These days, gcc, clang, and visual c++ build tools are by far the most popular C compilers. Each one has its own benefits, for example, gcc is the default compiler for most Linux distributions, it is up to date as per C++ standards, it is portable to many platforms, it is free.

Clang is an "LLVM native" C/C++/Objective-C compiler, state of the art in compiler technology, aims to achieve fast compiles, and it provides very useful and accurate information and highlights error messages, error line prompts, warning messages, error lines, and repair suggestions. It provides a platform for building great source level tools. 

CMake is rising in popularity, it is a free and open-source software build system used to control the software compilation process with simple platform and compiler free configuration files, and generate native build system scripts (makefiles, ninja, MSBuild) and workspaces that can be used in the compiler environment of your choice. CMake is a great tool to keep your build environment flexible and cross-platform. It gives you full control over the build system of a C/C++ environment. 

C and C++ might seem a bit old school, but they’re still hard to beat for their sheer speed and performance. With C and C++ communities, what’s often lacking was modern toolchain components like a package manager. 

Java (Maven), Ruby (Bundler), PhP (Composer), Python (PyPi), etc had their respective standard package managers but C and C++ languages had none. The C and C++ developers suffered a lot because of this and because of which they tried to create custom in-house solutions, that became costly to implement and to maintain, it was too complicated to reuse the libraries.

That is where Conan started working to reduce the pain of C and C++ developers by providing them a solution they want, which was missing for many years. Conan integrates really well with all major build tools like CMake, Visual Studio, Makefile, XCode etc

Short, reproducible build steps are a must-have for any continuous delivery pipeline in DevOps. In the C and C++ world, declarative dependency management is still a relatively new concept and acts as a big obstacle to reproducible, fast, and secure releases. This shows why package management is a good thing and how conan.io, as a package manager manages dependencies of C and C++ libraries.

C and C++ enter the world of DevOps

Continuous integration for C and C++ projects for a long time has proven to be a hard task due to the specific characteristics of these languages and the compilation to native code process. C and C++ projects usually face obstacles with upgrading dependencies, and it affects the continuous integration and continuous deployment process and from that point to the whole DevOps process.

There are ongoing efforts, and this is where Conan as a package manager stands out to help the community by making DevOps possible for C/C++ projects.

The Conan package manager helps to manage dependencies and binaries, and now with Artifactory’s support and a fine integration with any CI/CD tools like Jenkins, Codefresh, etc., it is achievable to define an effective and automated DevOps workflow.

Continuous Integration and delivery with proper package management will accelerate DevOps, it also helps in automation, increases the developer productivity and the software delivery rate. It is not that the package manager is DevOps, but it is the gate to that world of DevOps. The package managers reduce the confusion of dependencies and make the promotion of artifacts from one stage to next stage easier, helping developers collaborate with ease and make the software delivery process as quick as possible. 

Conan joined JFrog in 2016, with this joint force, the aim is to help the C/C++ community release better software faster than before. 

You can secure private C/C++ Conan repositories through Artifactory installation and get unmatched stability and reliability, it supports any number of build servers, users, and interactions. Artifactory offers massively scalable storage along with HA through cloud-based providers. 

Artifactory offers many benefits to C/C++ developers using Conan:

  • Secure and private repositories for C/C++ packages 
  • Fine-grained access management and control to development teams
  • Automatic layout and storage of C/C++ packages for all platforms 
  • The capability to provision C/C++ dependencies from Artifactory to the Conan command-line tool from local repositories.
  • Enterprise features such as high availability, massively scalable storage and much more

No doubt, C and C++ have a very big community and both the languages still rule the programming world with their high-performing capabilities. 

Programmers initially used C for system development work, and C language is near to assembly. Whenever we are required to interact with hardware, we need a language which can efficiently deal with hardware specifications, requirement, and change, C language does it very well. That is the reason C is used in embedded systems, self-driving cars, IoT implementation, and things like IoT are ruling the world. Hence, C as a language is always useful and helps programmers communicate well with the hardware and operating systems. 

There is a large online community of C and C++ users and experts that is particularly helpful in case any support is required. There are a lot of resources available on the internet. Some of the other online resources for C++ include StackOverflow, cppreference.com, Standard C++, etc. 

ConanCenter is a central repository for C and C++ packages, it is an effort to encourage organizations that rely on C and C++ projects to embrace best DevOps practices.