July 2020

CLion 2020.2 release: Makefile projects, C++20, enhanced static analysis, and doctest support

CLion 2020.2 is released!

CLion 2020.2: Makefile Projects, C++20, Enhanced Code analysis, Doctest, and Other Unit Testing Support Improvements

by Anastasia Kazakova

From the article:

CLion 2020.2 covers a wider variety of C and C++ projects and makes modern C++ coding easier. Here are the highlights:

  • Project models
    • Initial support for Makefile projects
    • CMake upgrade to 3.17
  • C++20 standard compliance
    • Code completion for C++20 keywords
    • Code completion in designated initializers
    • Support for the explicit(bool) construct in name hints, navigation, and refactorings
    • Range-based for loops with the init statement are now supported
  • Code analysis
    • A new inspection to constrain a function's result
    • Dangling pointer check
    • A more accurate Simplify inspection
    • Check for a loop condition that is never updated
    • New Inspection Widget and new Problems View
  • Support for Doctest, and improved integration with Catch2 and Google Test 1.10
  • Automatic creation of code coverage profiles
  • PlatformIO plugin enhancements
  • VCS:
    • Git installed in WSL2
    • A more helpful GitHub Pull Requests View
  • Performance improvements

std::ref and std::reference_wrapper: Common use cases -- Hitesh Kumar

fbgohNwY5aexuWMq9qJ95DEN.jpgMotivation behind reference_wrapper and common use cases.

std::ref and std::reference_wrapper: Common use cases

by Hitesh Kumar

From this article:

An std::reference_wrapper is a copyable and assignable object that emulates a reference. Contrary to its name, it does not wrap a reference. It works by encapsulating a pointer (T*) and by implicitly converting to a reference (T&). It cannot be default constructed or initialized with a temporary; therefore, it cannot be null or invalid.

CppCon 2019: There Are No Zero-cost Abstractions--Chandler Carruth

This year, CppCon 2020 is going virtual. The dates are still the same – September 14-18 – and we are aiming for the CppCon live event to have pretty much everything you’re familiar with at CppCon except moved online: multiple tracks including “back to basics” and a new “embedded” track; live speaker Q&A; live talk time zones friendly to Americas and EMEA (and we’re going to try to arrange around-the-clock recorded repeats in all time zones, where speakers who are available can be available for live Q&A in their repeated talks too, and we’ll do that if it’s possible – but we’re still working on it!); virtual tables where you can interact face-to-face online with other attendees just like at the physical event; virtual exhibitor spaces where you can meet the folks on your favorite product’s teams to ask them question face-to-face; pre- and post-conference classes; and even the CppCon house band playing live before every plenary session. All talk recordings will be freely available as usual on YouTube a month or two after the event, but everything else above will be available only live during CppCon week.

To whet your appetite for this year’s conference, here’s another of the top-rated talks from last year. Enjoy – and register today for CppCon 2020 – all the spirit and flavor of CppCon, this year all virtual and online!

There Are No Zero-cost Abstractions

by Chandler Carruth

Summary of the talk:

C++ is often described as providing zero-cost abstractions. Libraries offer up facilities documented as such. And of course, users read all of these advertisements and believe that the abstractions they are using are truly zero-cost.

Sadly, there is no truth in advertising here, and there are no zero-cost abstractions.

This talk will dive into what we mean by "zero-cost abstractions", and explain why it is at best misleading and at worst completely wrong to describe libraries this way. It will show case studies of where this has led to significant problems in practice as libraries are designed or used in unscalable and unsustainable ways. Finally, it will suggest a different framing and approach for discussing abstraction costs in modern C++ software.

CppCon 2019: Converting to C++20 Modules-Nathan Sidwell

This year, CppCon 2020 is going virtual. The dates are still the same – September 14-18 – and we are aiming for the CppCon live event to have pretty much everything you’re familiar with at CppCon except moved online: multiple tracks including “back to basics” and a new “embedded” track; live speaker Q&A; live talk time zones friendly to Americas and EMEA (and we’re going to try to arrange around-the-clock recorded repeats in all time zones, where speakers who are available can be available for live Q&A in their repeated talks too, and we’ll do that if it’s possible – but we’re still working on it!); virtual tables where you can interact face-to-face online with other attendees just like at the physical event; virtual exhibitor spaces where you can meet the folks on your favorite product’s teams to ask them question face-to-face; pre- and post-conference classes; and even the CppCon house band playing live before every plenary session. All talk recordings will be freely available as usual on YouTube a month or two after the event, but everything else above will be available only live during CppCon week.

To whet your appetite for this year’s conference, here’s another of the top-rated talks from last year. Enjoy – and register today for CppCon 2020 – all the spirit and flavor of CppCon, this year all virtual and online!

Converting to C++20 Modules

by Nathan Sidwell

Summary of the talk:

C++20 will have a module system, which provides benefits beyond simple code hygiene. C++20 modules uses new keywords and explicit source-level annotations. How do we get there from here?

I have been implementing this in the GNU compiler, and will talk about the broad strokes of the module specification.
I will describe how:
* one may incrementally convert source code,
* build systems might be augmented,

2020-07 mailing available

The 2020-07 mailing of new standards papers is now available.

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup
P1068R4 Vector API for random number generation Ilya Burylov 2020-07-15 2020-07 P1068R3 LEWG Library Evolution
P1184R2 A Module Mapper Nathan Sidwell 2020-07-10 2020-07 P1184R1 SG15 Tooling
P1272R3 Byteswapping for fun&&nuf Isabella Muerte 2020-07-14 2020-07 P1272R2 LWG Library
P1478R4 Byte-wise atomic memcpy Hans Boehm 2020-07-14 2020-07 P1478R3 LEWG Library Evolution
P1642R4 Freestanding Library: Easy [utilities], [ranges], and [iterators] Ben Craig 2020-07-12 2020-07 P1642R3 LEWG Library Evolution
P1659R1 starts_with and ends_with Christopher Di Bella 2020-07-15 2020-07 P1659R0 LWG Library
P1679R3 String Contains function Wim Leflere 2020-07-21 2020-07 P1679R2 LWG Library
P1726R4 Pointer lifetime-end zap Paul E. McKenney 2020-07-08 2020-07 P1726R3 SG1 Concurrency and Parallelism,SG12 Undefined and Unspecified Behavior,EWG Evolution
P1864R0 Defining Target Tuplets Isabella Muerte 2020-07-11 2020-07   SG15 Tooling
P2000R2 Direction for ISO C++ Michael Wong 2020-07-15 2020-07 P2000R1 All of WG21,Direction Group
P2029R2 Proposed resolution for core issues 411, 1656, and 2333; escapes in character and string literals Tom Honermann 2020-07-14 2020-07 P2029R1 CWG Core
P2075R1 Philox as an extension of the C++ RNG engines Pavel Dyakov 2020-07-15 2020-07 P2075R0 SG6 Numerics,LEWG Library Evolution
P2093R1 Formatted output Victor Zverovich 2020-07-18 2020-07 P2093R0 SG16 Unicode,LEWG Library Evolution
P2128R2 Multidimensional subscript operator Corentin Jabot 2020-07-12 2020-07 P2128R1 EWG Evolution
P2139R2 Reviewing Deprecated Facilities of C++20 for C++23 Alisdair Meredith 2020-07-15 2020-07 P2139R1 EWG Evolution,LEWG Library Evolution
P2146R2 Modern std::byte stream IO for C++ Amanda Kornoushenko 2020-07-21 2020-07 P2146R1 LEWGI SG18: LEWG Incubator
P2156R1 Allow Duplicate Attributes Erich Keane 2020-07-02 2020-07 P2156R0 EWG Evolution,CWG Core
P2161R2 Remove Default Candidate Executor Robert Leahy 2020-07-13 2020-07 P2161R1 LEWG Library Evolution
P2165R1 Compatibility between tuple and tuple-like objects Corentin Jabot 2020-07-14 2020-07 P2165R0 LEWG Library Evolution
P2169R1 A Nice Placeholder With No Name Corentin Jabot 2020-07-12 2020-07 P2169R0 EWG Evolution
P2178R1 Misc lexing and string handling improvements Corentin Jabot 2020-07-14 2020-07 P2178R0 SG16 Unicode,EWG Evolution
P2183R0 Executors Review: Properties David Olsen 2020-07-14 2020-07   LEWG Library Evolution
P2186R0 Removing Garbage Collection Support JF Bastien 2020-07-12 2020-07   EWG Evolution,LEWG Library Evolution
P2187R3 std::swap_if, std::predictable Nathan Myers 2020-07-14 2020-07 P2187R2 LEWGI SG18: LEWG Incubator,LEWG Library Evolution
P2188R1 Zap the Zap: Pointers are sometimes just bags of bits Anthony Williams 2020-07-15 2020-07 P2188R0 EWG Evolution
P2191R0 Modules: ADL & GMFs do not play together well (anymore) Nathan Sidwell 2020-07-10 2020-07   EWG Evolution
P2192R0 std::valstat - function return type Dusan B. Jovanovic 2020-07-13 2020-07   LEWGI SG18: LEWG Incubator
P2193R0 How to structure a teaching topic JC van WInkel 2020-06-26 2020-07   SG20 Education
P2193R1 How to structure a teaching topic JC van WInkel 2020-07-02 2020-07 P2193R0 SG20 Education
P2196R0 A lifetime-extending forwarder Vincent Reverdy 2020-07-15 2020-07   LEWGI SG18: LEWG Incubator
P2198R0 Freestanding Feature-Test Macros and Implementation-Defined Extensions Ben Craig 2020-07-12 2020-07   SG10 Feature Test
P2199R0 Concepts to differentiate types Isabella Muerte 2020-07-11 2020-07   LEWGI SG18: LEWG Incubator,LEWG Library Evolution
P2201R0 Mixed string literal concatenation Jens Maurer 2020-07-14 2020-07   SG16 Unicode
P2202R0 Senders/Receivers group Executors review report Gašper Ažman 2020-07-15 2020-07   LEWG Library Evolution
P2203R0 LEWG Executors Customization Point Report Ryan McDougall, Tomasz Kamiński 2020-07-15 2020-07   LEWG Library Evolution

DeepEnds 3.5: Make public members private

workflow.pngCycleRouter Ltd has released version 3.5 of their DeepEnds dependency analysis tool. A highlight:

Report and/or automatically rewrite public members that should be private

From the release announcement:

DeepEnds includes other dependency analysis tools to analyse coupling and cohesion, delete redundant code and

identify classes to extracted from C code. It parses C++, C# and Visual Basic source code.

The software is free to use until the end of August and will now install successfully via NuGet.

PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents

Static code analysis is most effective when changing a project, as errors are always more difficult to fix in the future than at an early stage. We continue expanding the options for using PVS-Studio in continuous development systems. This time, we'll show you how to configure pull request analysis using self-hosted agents in Microsoft Azure DevOps, using the example of the Minetest game.

PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents

by Alexey Govorov

From the article:

The result is a build system based on MSBuild for C++, with Chocolatey for installing PVS-Studio, CMake, and Git. Vcpkg is built for convenient management of the libraries that the project depends on. Also, we have to download the latest version of the Azure Pipelines Agent. To initialize the agent from the ENTRYPOINT Docker file, the PowerShell script 'entrypoint.ps1' is called, to which you need to add the URL of the project's "organization", the token of the agent pool, and the PVS-Studio license parameters....


 

 

CppCon 2019: Maintainability and Refactoring Impact of Higher-Level Design Features--Titus Winters

This year, CppCon 2020 is going virtual. The dates are still the same – September 14-18 – and we are aiming for the CppCon live event to have pretty much everything you’re familiar with at CppCon except moved online: multiple tracks including “back to basics” and a new “embedded” track; live speaker Q&A; live talk time zones friendly to Americas and EMEA (and we’re going to try to arrange around-the-clock recorded repeats in all time zones, where speakers who are available can be available for live Q&A in their repeated talks too, and we’ll do that if it’s possible – but we’re still working on it!); virtual tables where you can interact face-to-face online with other attendees just like at the physical event; virtual exhibitor spaces where you can meet the folks on your favorite product’s teams to ask them question face-to-face; pre- and post-conference classes; and even the CppCon house band playing live before every plenary session. All talk recordings will be freely available as usual on YouTube a month or two after the event, but everything else above will be available only live during CppCon week.

To whet your appetite for this year’s conference, here’s another of the top-rated talks from last year. Enjoy – and register today for CppCon 2020 – all the spirit and flavor of CppCon, this year all virtual and online!

Maintainability and Refactoring Impact of Higher-Level Design Features

by Titus Winters

Summary of the talk:

Higher levels of abstraction are useful for building things out of, but also have a higher cognitive and maintenance cost. That is, it's a lot easier to refactor a function than it is to change a type, and similarly easier to deal with a single concrete type than a class template, or a Concept, or a meta-Concept ... In this talk I'll present example strategies for refactoring the interface of functions, classes, and class templates. I'll also discuss how the recent addition of Concepts and the proposals for even-more-abstract features affect long-term refactoring in C++. If you're interested in refactoring and it isn't immediately clear that a Concept published in a library can never change, this talk is for you.

CppCon 2019: Back to Basics: Const as a Promise--Dan Saks

This year, CppCon 2020 is going virtual. The dates are still the same – September 14-18 – and we are aiming for the CppCon live event to have pretty much everything you’re familiar with at CppCon except moved online: multiple tracks including “back to basics” and a new “embedded” track; live speaker Q&A; live talk time zones friendly to Americas and EMEA (and we’re going to try to arrange around-the-clock recorded repeats in all time zones, where speakers who are available can be available for live Q&A in their repeated talks too, and we’ll do that if it’s possible – but we’re still working on it!); virtual tables where you can interact face-to-face online with other attendees just like at the physical event; virtual exhibitor spaces where you can meet the folks on your favorite product’s teams to ask them question face-to-face; pre- and post-conference classes; and even the CppCon house band playing live before every plenary session. All talk recordings will be freely available as usual on YouTube a month or two after the event, but everything else above will be available only live during CppCon week.

To whet your appetite for this year’s conference, here’s another of the top-rated talks from last year. Enjoy – and register today for CppCon 2020 – all the spirit and flavor of CppCon, this year all virtual and online!

Back to Basics: Const as a Promise

by Dan Saks

Summary of the talk:

The const qualifier has various uses in C++. One of the most valuable uses is in declaring function headings that constrain the effects of function calls. Using const appropriately can reduce bugs and development time by turning potential run-time errors into compile-time errors that are much easier to find and correct. Using const can even reduce your program’s code size and execution time.

Despite these benefits, too many C++ programmers still use const reactively rather than proactively. That is, they tend to add const as needed to quell compiler error messages, rather than design const in as they code. To get the most out of const, programmers really need to understand (1) when and where to place const in declarations, (2) when to leave it out entirely, and (3) how type conversions involving const behave.

The key insight about const is to understand const as a promise—a promise not to modify something. This session explains the real meaning of that promise and how that insight can guide you in declaring function parameters and return types. It also explains why you shouldn’t declare by-value parameters and return types as const, why overloading on const is such a useful and ubiquitous idiom, and why it is meaningful to declare constexpr member functions as const.