Sean Baxter and the C++ Alliance: Leading the Charge for C++ Safety

In the world of systems programming, C++ remains one of the most powerful and widely used languages, primarily because of its unmatched performance and fine-grained control over hardware. However, C++ also has a reputation for being notoriously difficult to manage safely. Memory leaks, buffer overflows, undefined behavior, and other issues can easily arise if programmers don’t carefully follow best practices, leading to vulnerabilities and bugs in production systems. This is where efforts like those of Sean Baxter and the C++ Alliance come into play, focusing on improving C++ safety through innovation, tools, and community initiatives.

Continue reading “Sean Baxter and the C++ Alliance: Leading the Charge for C++ Safety”

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?”