DEV Community

Rohit More
Rohit More

Posted on

C++ is being replaced by Carbon?

When it comes to system programming and application development, the general-purpose programming language C++ provides excellent versatility. To ensure high-quality programming, however, developers must be aware of some language traps.

In an effort to replace the venerable but problematic C++, Google researchers have introduced a brand-new "experimental" open source programming language called Carbon.

Carbon could serve as a successor language to C++, one that provides a simple starting point for developers to a newer language that addresses contemporary development concepts like memory safety and generics. This would be similar to how Microsoft built Typescript to update JavaScript and Kotlin to strengthen weaknesses in Java.

Pitfalls of C++

C++ has long been the preferred language for creating performance-critical applications, but it has a number of problems that make it difficult for current developers to use it.

It carries with it many of the archaic habits that were a part of the language's predecessor, C, and has accrued decades' worth of technical debt. Backward compatibility is given top priority by C++'s guardians in order to maintain support for popular projects like Linux and its network of package managers.

Another obstacle to the language's progress is a bureaucratic committee approach that prioritizes standardization over design. It may make adding new features challenging. In a waterfall approach that might take years, a select committee makes crucial decisions in the mainly secretive development of C++.

How Carbon offers remedies

Carbon's design hopes to have a core working version ("0.1") available. A generics system, which eliminates the need to examine and review the code for each instantiation, is one of the current programming principles on which Carbon will be constructed.

Memory safety is a crucial element that C++ is missing. One of the main sources of security flaws is memory access issues. The development of dynamic bounds checks, greater tracking of uninitialized states, and a thorough default debug build mode are all goals of the Carbon team. The creators intend to create a secure Carbon subset over time. According to the documentation, the language will support:

  • Performance-critical software
  • Software and language evolution
  • Code that is easy to read, understand, and write
  • Practical safety and testing mechanisms
  • Fast and scalable development
  • Modern OS platforms, hardware architectures, and environments
  • Interoperability with and migration from existing C++ code.
  • The development team will also set out to create a built-in package manager, something that C++ sorely lacks.
  • Conclusion
  • The replacement is not going to happen tomorrow or next. C++ will still be relevant in the next decade. That being said, Carbon is an experiment. There are no guarantees, it may fail to meet its goal. Thanks so much for reading. The comment section is open for you to share your thoughts.

Top comments (0)