December 2019

Overload 154 is now available

ACCU’s Overload journal of December 2019 is out. It contains the following C++ related articles.

Overload 154 is now available

From the journal:

Inside-Out.
Sometimes things appear to be inside out. Frances Buontempo considers when a shift of perspective can make things seem better.

Trip Reports: Meeting C++ 2019 and Embedded C++ 2019.
Deciding which conferences to attend is difficult, and we can’t go to them all. Svitlana Lubenska, Hans Vredeveld and Benedikt Mandelkow give us a flavour of what we may have missed.

Non-Recursive Compile Time Sort.
Compile time sorting usually uses recursion. Norman Wilson shows how C++14 features make this easier.

Quick Modular Calculations (Part 1).
Compilers are good at optimising modular calculations. Can we they do better? Cassio Neri shows they can.

Afterwood.
We are aware of the film Get Carter. Chris Oldwood asks if it should be called Acquire Carter instead.

Introducing the new ReSharper C++ 2019.3 -- Igor Akhmetov

Welcome ReSharper C++ 2019.3

ReSharper C++ 2019.3: C++20 Concepts, Type Hints, Sorting of #includes, and more

by Igor Akhmetov

From the article:

Please welcome ReSharper C++ 2019.3, our third and final update of this year! Main highlights:

  • More sophisticated C++20 support, including Concepts.
  • Clang-Tidy updates and more flexible integration.
  • A new quick-fix will assist you with adding variables to the lambda capture list.
  • New type hints for auto variables, in structured bindings, for function and lambda return types.
  • Navigation improvements.
  • Sorting of #include directives.
  • More templates to generate UE4-specific code, as well as support for UE4’s Smart Pointers.
  • Additional project properties.
  • Performance enhancements.

Generators and the Sweet Syntactic Sugar of Coroutines--Adi Shavit

A very detailed and interesting article, a must read!

Generators and the Sweet Syntactic Sugar of Coroutines

by Adi Shavit

From the article:

“Coroutines make it trivial to define your own ranges.”
— Eric Niebler, Lead author of the C++ Ranges proposal (edited for drama)

Hmmm… is that so?
But wait, what are coroutines?

From Boost.Coroutine2: A coroutine (coined by Melvin Conway in 1958!) is a function that can suspend execution to be resumed later. It allows suspending and resuming execution at certain locations and preserves the local state of execution and allows re-entering the subroutine more than once. In contrast to threads, which are pre-emptive, coroutine switches are cooperative: the programmer controls when a switch will happen. The kernel is not involved in the coroutine switches.

This sounds just like what we want!

Don’t Make Your Interfaces *Deceptively* Simple--Jonathan Boccara

A good thing to think about.

Don’t Make Your Interfaces *Deceptively* Simple

by Jonathan Boccara

From the article:

Just because we can provide an interface doesn’t mean that we should.

At least this is one of the takeaways that I got from from Howard Hinnant’s opening keynote at Meeting C++ 2019.

In this impressive keynote, Howard made a presentation about <chrono> and the host of features it brings in C++20. But beyond showing us how to use <chrono>, Howard explained some of the design rationale of this library.

Those are precious lessons of design, especially coming from someone who had a substantial impact on the design of the standard library. I believe we can apply those practices to our own code when designing interfaces.

So, just because we can provide an interface doesn’t mean that we should. To illustrate what this means in practice, let’s go over two examples in the C++ standard library...

PVS-Studio 7.05

We're glad to offer to your attention a quick overview of the PVS-Studio 7.05 code analyzer release. The analyzer is enriched with twenty new diagnostics and infrastructure improvements.

PVS-Studio 7.05

by Andrey Karpov

From the article:

The Blame Notifier utility meant to notify developers about the analysis results is now available on all platforms supported by the analyzer (Windows, Linux, macOS). Blame Notifier uses the information from the version control system (SVN, Git, Mercurial) to identify the person who wrote the code that triggered an analyzer warning.

C++ coroutines: Getting started with awaitable objects--Raymond Chen

So many possibilities!

C++ coroutines: Getting started with awaitable objects

by Raymond Chen

From the article:

Coroutines were added to C++20, and Lewis Baker has a nice introduction to them.

  • Coroutine theory.
  • Understanding operator co_await.
  • Understanding the promise type.

But I’m going to write another one, taking a more practical approach: The least you need to know to accomplish various coroutine tasks...