According to Tiobe C++ surpasses C for the first time in history, The Streisand Effect works :)

In the world of programming languages, C++ has long been a staple, valued for its power and performance. However, it’s also been the subject of significant criticism over the years. Interestingly, these criticisms often have an unintended consequence, making C++ even more popular—a phenomenon known as the Streisand Effect.

Recently, C++ faced widespread criticism, with even the White House advising against its use. Ironically, this led to an increase in its popularity. According to TIOBE, C++ has surpassed C in popularity for the first time in history.

Continue reading “According to Tiobe C++ surpasses C for the first time in history, The Streisand Effect works :)”

Could Herb Sutter’s call to action for C++ safety be acheived soon?

Recently, Herb Sutter wrote an excellent article on C++ safety. He discussed numerous ideas, but I’ll provide a summary of his perspective on what can be done in the medium term to enhance C++ safety.

In C++, by default enforce …(A) Solution for new/updated code (can require code changes — no link/binary changes)(B) Solution for existing code (requires recompile only — no manual code changes, no link/binary changes)
Type safetyBan all inherently unsafe casts and conversionsMake unsafe casts and conversions with a safe alternative do the safe thing
Bounds safetyBan pointer arithmetic Ban unchecked iterator arithmeticCheck in-bounds for all allowed iterator arithmetic Check in-bounds for all subscript operations
Initialization safetyRequire all variables to be initialized (either at declaration, or before first use)
Lifetime safetyStatically diagnose many common pointer/iterator lifetime error casesCheck not-null for all pointer dereferences
Less undefined behaviorStatically diagnose known UB/bug cases, to error on actual bugs in existing code with just a recompile and zero false positives:
Ban mathematically invalid comparison chains
(add additional cases from UB Annex review)
Automatically fix known UB/bug cases, to make current bugs in existing code be actually correct with just a recompile and zero false positives:
Define mathematically valid comparison chains
Default return *this; for C assignment operators that return C&
(add additional cases from UB Annex review)

But what are the current possibilities for achieving this goal?

Continue reading “Could Herb Sutter’s call to action for C++ safety be acheived soon?”

Try to understand the motivations behind the new C++ features to use them better when needed.

In the world of software development, languages evolve over time to improve efficiency, usability, and performance. C++ is not an exception. Understanding why a feature is added can significantly enhance how developers use it, leading to better, more maintainable code.

For C++ developers who have not yet mastered the new C++ features, it’s recommended to understand at least one key motivation behind each feature. This way, when a specific need arises, the developer can identify which feature might be useful and then delve deeper into learning how to implement it.

Here are the motivations behind some new C++ features:

Continue reading “Try to understand the motivations behind the new C++ features to use them better when needed.”

Back 60 years ago marked the rise of the ancestor of C/C++, thanks to Martin Richards.

Do you know with which programming language this code is written:

// Hello world demo
get "streams.d"
external
[
Ws
]

let Main() be
[
Ws("Hello World!*N")
]

It’s the BCPL programming language . BCPL (Basic Combined Programming Language) is a foundational language in the history of programming languages. Developed by Martin Richards in 1966, BCPL’s simplicity, typeless nature, and portability were key features that influenced the design of many subsequent languages, including B and C. Its impact is particularly notable in the development of system software and compilers, making it a critical step in the evolution of programming languages.

Continue reading “Back 60 years ago marked the rise of the ancestor of C/C++, thanks to Martin Richards.”

C++26 is coming, but what are the major features that have been added to C++ since C++11?

Modern C++ has seen a series of significant updates starting from C++11, each bringing new features and enhancements that aim to make the language more efficient, readable, and maintainable. Here’s a brief overview of the major features introduced in each version since C++11, along with a comment on their usage:

C++11

C++11 marked a significant evolution in the C++ language, introducing several powerful features that modernized and simplified C++ programming. Here are some of the most impactful features, along with examples to illustrate their usage:

Continue reading “C++26 is coming, but what are the major features that have been added to C++ since C++11?”

To developers who heavily rely on AI for generating C++ code. Be careful.

AI-driven code generation has become an increasingly important aspect of software development, leveraging advanced models to write, optimize, and understand code. However, AI is not intended to replace developers but rather to aid them in their tasks. Ultimately, it is up to humans to determine how to utilize AI suggestions. Let’s consider this query we posed to GPT-4o:

give me a c++ functon to add 2 big integers

Here’s the answer:

Continue reading “To developers who heavily rely on AI for generating C++ code. Be careful.”

Benefits of well-Designed projects : GCC vs Clang

GCC (GNU Compiler Collection) and Clang are two of the most prominent C++ compilers in the world of software development. Each has a unique design philosophy and architecture that caters to different needs and preferences. This article explores the fundamental design differences between GCC and Clang, highlighting how these differences impact their functionality, performance, and usability.

Continue reading “Benefits of well-Designed projects : GCC vs Clang”

Understanding Small String Optimization (SSO) in std::string

In the world of C++ programming, efficient memory management is crucial for optimal performance. One fascinating feature that many modern implementations of std::string offer is Small String Optimization (SSO). This clever optimization can significantly enhance the performance of string operations by minimizing heap allocations for small strings. Let’s dive into what SSO is, how it works, and why it matters.

Continue reading “Understanding Small String Optimization (SSO) in std::string”

The majority of code executed on a Windows PC is developed in C++, so it’s expected to encounter more issues in C++ code.

Recently, numerous articles have highlighted issues in C++ code, and even the White House has discouraged the use of C++ in favor of promoting Rust. However, does this perspective consider the extensive use of C++ compared to other programming languages? In this post, we will explore the fact that the majority of code executed on a Windows PC is developed in C++. What if most of this code were developed in Rust, C#, or Java? Would we still have the same incredible user experience we enjoy today? Let’s delve into this question and examine the potential implications.

The usage patterns of Windows users vary widely, but several key activities dominate their screen time. We can enumerate:

Continue reading “The majority of code executed on a Windows PC is developed in C++, so it’s expected to encounter more issues in C++ code.”