News

C++ Annotated: November 2020. We’re Launching a YouTube Show!

Hi,

Welcome to the newest edition of C++ Annotated. We have some exciting news for you – from now on we’ll be publishing monthly! Plus, in addition to the regular digest, we’re launching a YouTube show called No Diagnostic Required, hosted by Phil Nash, JetBrains Developer Advocate, and myself, Anastasia Kazakova, JetBrains C++ Tools PMM. And we’re going to do a podcast too! This means that C++ Annotated will be available in multiple formats:

  • The regular digest which will now be published monthly on this blog (subscribe using the form on the right).
  • C++ Annotated emails, which you can subscribe to by filling out this form.
  • Our No Diagnostic Required show here in the blog or on YouTube. You can also check out the website of the show and follow it on Twitter.
  • We’ll soon be launching the podcast format of No Diagnostic Required, so stay tuned!

No Diagnostic Required

November news

New C++ podcasts worth following

There was a time when CppCast was the only C++ podcast in the ecosystem. Later, Jason Turner started C++ Weekly on YouTube. Then CppChat was launched by Jon Kalb and Phil Nash. More recently, a few more interesting abbreviations entered the ecosystem:

TLB Hit by Chris Leary and JF Bastien. This podcast is about systems and compilers and is heavily focused on how particular things work. One of the best things about it is the long and detailed notes that accompany every episode, with the blocks of code and other stuff mentioned in the show. You can even choose to read rather than listen, and tune in to the interesting bits using timestamps when something grabs your attention. The second episode (which is obviously named #1) is about storing a zero to address 0. It gets into the meaning of undefined behaviour, looks at assembly, talks about memory and memory access, and of course about a segmentation fault.

ADSP by Conor Hoekstra and Bryce Adelstein Lelbach. The podcast name is an abbreviation for Algorithms + Data Structures = Programs. Episode #0 is a good place to learn a few useful algorithms, like std::transform_reduce and std::inner_product (have you ever wondered whether C++ has a zip function?).

PVC (in Russian) by the C++ Russia Conference program committee. The Pure Virtual Cast YouTube show was started by the C++ Russia Conference program committee to drive discussions in the community between conferences (C++ Russia is usually held twice per year).

And now Phil and I have started NDR, the YouTube show (already here!) and podcast (still to come) for C++ Annotated! If you need an explanation for where the ‘No Diagnostic Required’ name comes from, I suggest you check out this link.

ISO C++ trip report by Herb Sutter

After 9 months of virtual subgroup meetings, the C++ committee held the final full-committee (plenary) meeting of 2020. This first-ever virtual plenary brought us the first C++23 promises. Herb’s trip report (we’re not sure what “trip” means here) gives a summary of the results.

For safer and more convenient usage, size_t got a literal suffix. In fact, not just one, but two! You can use either uz or zu. They both have the same meaning. Perhaps even more interesting is that we also got z as a suffix for a signed version of size_t – even though no corresponding type has been named (yet) in the standard.

Next, C++23.contains(“.contains”)! Finally! This is due to adding a contains function to the basic_string and basic_string_view class templates. Python, Java, C#, and Rust developers will already be familiar with this. Now it has come to C++ as well (although the Boost algorithms library has had it for a while)!

We also got a stacktrace library, based on Boost.Stacktrace, and a type trait to detect scoped enumerations (is_scoped_enum). With the latter, you can check if an enumeration is scoped or unscoped and apply different behaviour depending on the result.

Another accepted proposal enables "shared" headers that use atomics and can be included from either C or C++ code. The proposed solution is not completely new but has been used by Android platform code for several years. Also, for more C and C++ coordination, a new study group, SG22, for C/C++ liaison was created.

Talking about organizational changes, Richard Smith has now been replaced by Thomas Köppe as project editor for the C++ standard. These C++ experts definitely know the standard word for word.

Modules support in Visual Studio… and in GCC 11!

By now, every C++ developer knows the updated standard has modules. While CMake still doesn’t support the feature, Microsoft has delivered it for Visual Studio! You can now create modules via the Add New Item dialog, review them in the Solution Explorer, and reference modules that exist on disk. Visual Studio IntelliSense is confirmed to work with modules as well.

The C++20 modules code is now under review in GCC! It’s targeted to be included in the GCC 11 release planned for the next year.

Qt6 libraries via Conan

Three libraries (Qt Network Authorization, Qt Image Formats, and Qt 3D) are now delivered in Qt6 via a package manager, with more to come in the future. Qt now uses Conan, and the build recipes require CMake and Ninja to build the module. This is an important move for the C++ community, where a standard package and dependency manager is lacking.

CLion 2020.3: It’s all about debug!

The final major release of this year for JetBrains’ cross-platform C/C++ IDE has arrived. With three new major debugger capabilities (Debug with Root/Administrator privileges, Debug with code dump, and a new Set Execution Point action) this new version centers around a significantly enhanced debugger experience. Meanwhile, there is also initial support for MISRA guidelines, the CTest (CMake test runner) integration, Qt-specific project and file templates, and Qt-tuned IDE actions like code completion. Check out the blog post for details.

ReSharper C++ 2020.3: The perfect game dev companion for Unreal Engine!

The ReSharper C++ 2020.3 release is just around the corner. You can expect it in December 2020. In this version, we take another step toward full C++20 support by implementing the C++20 comparison rules and adding new inspections to help you adopt the C++20 ranges library. Meanwhile, Unreal Engine developers can take advantage of the editor integration with the UnrealHeaderTool, an improved project model, and new inspections based on control-flow analysis in HLSL shader files. Check the recent preview news in the blog.

std::visit is everything wrong with modern C++

This blog post from 2017 started trending on the r/cpp subreddit recently. With C++20 dropping, it seems that the sentiment hasn’t changed. C++ is too complex, even for simple tasks. Not everyone agrees, of course. But ultimately, the ongoing problem will always be that fixing C++ to make it simpler effectively makes it more complex, because we can (almost) never take things out.

With std::visit specifically, there is an active proposal for adding pattern matching to the language. This was mentioned in passing in the article but was largely dismissed, perhaps because it seemed only a remote possibility in 2017. But, in 2020, the proposal is coming along nicely, having been built upon preceding proposals. We had originally hoped it would be on track for C++23, but with progress slowing down during the pandemic, it’s looking less likely. Our unwelcome visitor may have to stay a little longer.

Now for the video!

To wrap up the November news, check out our first episode of No Diagnostic Required:

The JetBrains C++ team
The Drive to Develop

image description