TNS
VOXPOP
Where are you using WebAssembly?
Wasm promises to let developers build once and run anywhere. Are you using it yet?
At work, for production apps
0%
At work, but not for production apps
0%
I don’t use WebAssembly but expect to when the technology matures
0%
I have no plans to use WebAssembly
0%
No plans and I get mad whenever I see the buzzword
0%
C++ / Software Development

C++ on the Move

While the C++ programming language seems to be as popular as ever, efforts to move it forward are ongoing both inside the ISO C++ steering committee as well as other projects.
Mar 6th, 2023 7:13am by
Featued image for: C++ on the Move

While efforts to replace C++ or bolster the workhorse systems programming language continue, work on the proper C++ standard continues apace with the ISO C++ committee last month completing technical work on C++23, the latest release of the spec.

In short, C++23 is feature complete and work is underway on the next version, C++26, said Herb Sutter, chair of the ISO C++ standards committee and software architect at Microsoft, in a blog post.

In the Wild

Meanwhile, in the wild, C++ appears to be on fire in terms of popularity among developers. According to the TIOBE Index of programming languages, last month C++ was the fastest growing programming language — moving up nearly 6 (5.93%) percentage points over the same period the prior year. In addition, in January TIOBE awarded C++ as the programming language as it had the biggest gain in popularity in 2022. Overall, in 2022 C++ popularity grew by 4.62 percentage points year over year leading all others. For March 2023, C++ rose 4.64% over the same period last year and ranked as the fourth most popular language behind Python, C and Java, in that order.

“Its excellent performance while being a high-level object-oriented language. Because of this, it is possible to develop fast and vast software systems (over millions of lines of code) in C++ without necessarily ending up in a maintenance nightmare,” TIOBE said of C++ in a statement.

Moreover, “Performance seemed to be important. C++ competitor Rust entered the top 20 again (being at position #26 one year ago), but this time it seems to be for real,” TIOBE said.

The C++ programming language has many uses including building software infrastructure and resource-constrained applications, including desktop applications, video games, servers for e-commerce, web search or databases, and performance-critical applications like telephone switches or even space probes.

Committee Work

Meanwhile, as the steering committee finished technical work on C++23, “No features were added or removed, we just handled fit-and-finish issues and primarily focused on finishing addressing the 137 national body comments we received in the summer’s international comment ballot (Committee Draft, or CD),” Sutter wrote. “You can find a list of C++23 features here, many of them already implemented in major compilers and libraries. C++23’s main theme was ‘completing C++20,’ and some of the highlights include module ‘std’, ‘if consteval,’ explicit ‘this’ parameters, still more constexpr, still more CTAD, ‘[[assume]]’, simplifying implicit move, multidimensional and static ‘operator[]’, a bunch of Unicode improvements.”

Also, “In addition to C++23 work, we also had time to make progress on a number of post-C++23 proposals, including continued work on contracts, SIMD execution, and more,” he said.

C++ in Visual Studio 17.5

Last month also saw the general availability of Microsoft’s Visual Studio 17.5, which included new features for C++, including modern C++ and game development features. This release also includes several productivity enhancements for C++ developers including a UE Asset inspector and IntelliSense improvements for macro expansions. All these features aid in the development of games, cross-platform, or embedded applications, the company said.

For C++23 standards conformance, “We’re continuing our work on standards conformance for C++23, giving you several new standard library features to try out,” wrote Sy Brand, a C++ Developer Advocate on Microsoft’s C++ Team in a blog post:

std::ranges::fold_left, fold_right and friends define fold operations, similar to std::accumulate, but more general. For example:

std::vector<double> v = {0.25, 0.75};

auto sum = ranges::fold_left(v, 0, std::plus());

The release also delivers new build performance, developer productivity and code safety features for C++, Brand explained.

Evolve or Else?

“I don’t need to search C++ code, so the new search tools don’t do much for me there,” said Richard Campbell, Non-Executive Chairperson at CloudArmy, a Microsoft regional director, Microsoft MVP and founder of DEVintersection among other things.

“It’s interesting to look at how C++ has been modernizing over the past few years — such as adding async and await from C# into the language,” Campbell told The New Stack. “This whole conversation about safety in C++ represents a fundamental change. After all, C++ is the famously ‘unsafe’ language, which is to say, the onus for safety is on the developer and their debugger rather than the language itself.”

Campbell explained that the argument for this was speed, speed, speed — when you add type and memory safety into a language, you’re adding extra execution steps for every bit of code you run. Yet, does speed matter that much? Processors and memory are remarkably speedy these days. Does anyone care if your function runs in .05 seconds without safety or .1 seconds with safety?

“Now bring Rust to the table — a language well-suited for the low-level programming that C++ typically dominates, but with built-in memory safety and other modern features,” Campbell said. “When luminaries like Mark Russinovich are saying things like [‘…halt starting any new projects in C/C++ and use Rust…’], C++ must evolve or be left behind. The question is, at what price?” he said.

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.