News

C++ Ecosystem in 2021: 1 in 5 C++ developers are using C++20 and a third of us are not writing any unit tests at all, and other facts

The Developer Ecosystem 2021 report is now available!

Every year we ask thousands of developers, with various backgrounds from all around the globe, dozens of questions, which we have localized into many different languages. We then clean, weigh, and process the data carefully, and validate it against other data sources. Our goal is to extract the key trends, which we will present through infographics to the public. This data is used across JetBrains to help our team make the right decisions on both global and product-levels. We are happy to share this data with the community so we can all thrive together!

The full report for 2021 is now available. We invite you to read through the key takeaways and detailed data for many programming languages and areas of software development.

DevEco C++ 2021

Let’s discuss the C++ results with experts!

We’ve invited two guests to join us and take a closer look at this year’s C++ results and what they mean to the C++ community:

We’d like to thank Matt and Andreas for joining the discussion.

We gave our guests early access to the results and asked them about their general impressions on the state of the C++ ecosystem through 3 questions:

  • What was the most surprising data from 2021?
  • Is there anything in the results that you find especially encouraging from the perspective of the evolution of the C++ ecosystem?
  • Is there anything in the results that you find extremely disappointing from the perspective of the evolution of the C++ ecosystem?

I. What was the most surprising data from 2021?

Andreas:
The top-3 surprises for me are:

  • How many people are not using any static analysis or automatic code formatting
  • How many people are still using C++98/C++03
  • GCC is growing more than Clang!

Matt:

  • It is interesting to see open source compilers topping the list of regularly used compilers. In my world, being on Linux makes the MSVC compilers unavailable to me, but I have always thought that the programmers on Windows would outnumber us, and so the MSVC usage would be higher.

II. Is there anything in the results you find especially encouraging from the perspective of the evolution of the C++ ecosystem?

Andreas:
The hype around modules is very encouraging! Better encapsulation and reduced compile times for libraries will be a huge boost to the ecosystem!

Matt:
It is nice to see the adoption of modern C++. 1 in 5 respondents are on the latest standard, which is great, and many more are planning on migrating to at least C++17 in the next year. Modules and concepts seem to be some of the strongest motivators to adopt a newer standard. I’m finding concepts valuable, but I haven’t yet gotten my head around modules, and I’m hoping tooling will help me move to modules as it becomes more widely supported.
Besides that, it’s great to see many people using static analysis.

III. Is there anything in the results you find extremely disappointing from the perspective of the evolution of the C++ ecosystem?

Andreas:
The fragmentation in build systems and package management continues to be an issue. While it’s good to explore different solutions, I think the C++ community can learn a lot from other languages that have chosen to go with a single unified approach to build/package management.

Matt:
It is still disappointing to see that a third of the developers are not writing any unit tests at all.
Nearly 3/4 of respondents are suffering from lack of good packaging solutions – having to build libraries separately, prebuild, or use system package management means either developer toil or reliance on external parties to build them. That can mean getting behind on new versions and it adds complexity to upgrading or changing compilers.

Where is the C++ ecosystem now?

C++ language standards adoption

While there is still a stable audience for C++98/C++03, newer standards are constantly growing and taking developers away from previous versions. This is how the timeline for C++11 and newer standards looks through the years we’ve been running the research:

C++ Srandards

Just to highlight this: in 2021, 1 in 5 C++ developers are using the latest officially signed C++20 standard even though it’s not yet fully supported in all major compilers! Many of us believe that C++20 is the next big release after C++11 and will have a huge impact on the C++ ecosystem. It looks like this could be true! Take a look at the top-3 C++20 big features and how many developers plan to adopt them soon: 48% for Modules, 46% for Concepts, and 33% for Coroutines.

Andreas:
Modules tops the charts as expected. With C++ build times constantly getting worse, it will be very interesting to see how people use modules to push back against this trend.

It is interesting that in game development, Concepts are ahead of the other features in terms of plans to adopt them with 53%. Of course, these developers are still waiting for the reflection mechanism that is not yet available natively in the C++ language.

Later this year, the C++ Standard Committee plans to make C++23 “feature complete”. However, it now seems it will be a bug-fix release (even though many of the upcoming improvements are very useful), which totally makes sense after such a huge update.

Looking at the C++ standards migration charts from the report, it’s interesting to see how the share of those who don’t plan to update drops between “from C++11” and “from C++14” transition paths:
Migration from C++11 Migration from C++14

Andreas (on some of the transition paths):
From C++98/03: While this looks promising, I wish more teams would take the opportunity to make a greater leap than just going to C++11, which is already a decade old at this point.
From C++11: It’s great to see that so many are looking to skip over C++14 and go directly to C++17 or C++20.
From C++17: It makes sense that lots of people who were already on C++17 are eager to adopt C++20.

Let’s talk about the code quality

To improve code quality and catch potential issues in the early stages, static code analysis tools are very useful. There are many of them, and we can see a lot of activity in this part of the C++ market. The Clang ecosystem is growing blazingly fast, with many tools based on LLVM as a back-end. It is no real surprise that Clang-based tools are trending in the list of tools for Code Analysis and guideline enforcements:
Code analysis tools
Andreas:
It’s also good to see that people are using static analysis tools. Even if you don’t have the budget for paid tools, the free tools like Clang-tidy and Clang-analyzer are great.

Still, the majority of C++ developers prefer tools bundled into their IDEs. We are seeing many code analysis tools providing plugins for the major C++ IDEs on the market. For example, in the recent edition of C++ Annotated we talked about new 3rd party plugins for Code Analysis for CLion – SonarLint and PVS-Studio.

The second most popular response to the question of what code analysis tools do you use was “None”.

Andreas:
The “30% None” crowd needs to wake up and try some static analysis. I guarantee they will find real bugs!
At first, you would think these people use no code analysis at all. So did we! However, while preparing my talk “Code Analysis++” for C++Now 2021, I realized that some of these developers rely on code analysis on CI, like SonarQube. After a few confirmations from the C++ community members, we plan to update the list of possible answers next year to cover this case and, hopefully, decrease the share of “None” answers to this question. By the way, at JetBrains, we are also working on providing the code analyzers from our IDEs as CI services. For that, we’ve recently started the Qodana Early Preview. We hope C++ linters from CLion will soon become a part of it too!

Is there a standard build system for C++?

That’s a very good question. We tend to say there isn’t, and instead we have many options, like Makefiles, Autotools, CMake, Visual Studio, Bazel, Meson, Scons, and many others. What are your thoughts here?
Bryce Adelstein Lelbach, the chair of Standard C++ Library Evolution group, in his talk “What Belongs In The C++ Standard Library?” at C++Now earlier this year, stated that we actually have one! It’s CMake. If you still have concerns here, just look at how it has grown over the years (let’s compare the top-3 most popular build systems in C++ through the last 5 years):
Build systems in C++

There are many open source projects that tended to use Makefile in the past, but are moving to CMake these days.

What about other C++ tools?

For unit testing, Google Test is trending, the same as in previous years. But we agree with Matt:
It is still disappointing to see a third of developers not writing any unit tests at all.

Dependency management is one of the major pain points for C++ developers. We still mostly build libraries as part of our projects, which is not an easy task given the variety of possible build systems in the C++ world.
Dependencies in C++
Matt:
Nearly three quarters of respondents lack a good packaging solution. Having to build libraries separately, prebuild, or use system package management means either developer labor or reliance on external parties to build them. That can mean getting behind on new versions, and adds complexity to upgrading or changing compilers.

Andreas:
It wouldn’t be C++ if we didn’t have many competing solutions to this problem, but I can’t help but wonder if we’d all be better off if we just picked one and went with it.

We’d love to know what you think about dependency management in C++? Do you use Conan, Nuget, or vcpkg? Leave us a comment below.

While we are still on the topic of tools, we are pleased to see that CLion is in the top-3. We have big plans to improve and evolve CLion in various directions. We keep an eye on the current trends in the C++ ecosystem and make sure there is support in CLion for our users to utilize them.

Andreas:
Quite impressive numbers from CLion considering it’s such a young IDE. I can see why though, having recently switched to it myself!
If you are working on a non-commercial open source project, don’t forget you qualify for a free license for our IDEs!

Comparing to C++ Foundation Lite Survey 2021

Validating Developer Ecosystem results against other community surveys and research is important and helps make us confident in the results. Even when the results are different, it’s not always a bug, but often it is down to different methodology. Understanding these differences help us understand the trends correctly. For C++, we validate our results against C++ Foundation Lite Survey results.

This year, there are 2276 responses in the Developer Ecosystem survey and 1873 in the C++ Foundation survey. We spotted a few major differences in the data origins:

  1. Experience: The majority of the C++ Foundation Lite survey respondents have 10+ and even 20+ years of programming experience. For Developer Ecosystem research (C++ audience) more than a half of the respondents have 1-5 years of experience.
  2. Geography: We are also geographically different, as the top-3 countries in C++ Foundation results are the United States, Germany, and Russia, while in the Developer Ecosystem (C++ part) it’s China, India, and the United States. This bias is likely because the C++ Foundation Lite survey is only provided in English, while the Developer Ecosystem survey is localized into 9 additional languages.
  3. Specialization: Gaming is trending in the areas of development in C++ Foundation Lite results this year (they got 31%). That’s why the results are often shifted towards the Microsoft ecosystem and tools (which is a default for many developers in this area).

You can learn more about Developer Ecosystem methodology in the corresponding section of the report.

To compare, we apply the same methodology and selection process to the raw data of both surveys. In the resulting groups similar trends are observed, but some differences are still present:

  • While the top-3 project models are the same, Ninja and Qmake are twice as popular among C++ Foundation Lite survey respondents.
  • Developer Ecosystem respondents tend to use more programming languages besides C++. Java, JavaScript, SQL, PHP, Swift, and Kotlin are much more popular among them, whereas C++ Foundation Lite survey respondents use Assembly, Objective-C, and Haskell more actively.

That’s it! Check out the full report and let us know which trends you find the most interesting and exciting, and which are a little disappointing to you.

CHECK THE FULL REPORT

The JetBrains C++ team
The Drive to Develop

image description