February 2021

GotW #100 Solution: Preconditions, part 1 -- Herb Sutter

Solution just posted:

GotW #100 Solution: Preconditions, Part 1

by Herb Sutter

From the article:

We've seen how postconditions are directly related to assertions (see GotWs #97 and #99). So are preconditions, but that in one important way makes them fundamentally different. What is that? And why would having language support benefit us even more for writing preconditions more than for the other two?

Contribute your insights about C++ community – Developer Ecosystem 2021 survey

Every year we run an extensive survey on the IT communities all over the world. And we do share then results and the raw data with the community for free.

Contribute your insights about C++ to the coding community! Take the Developer Ecosystem 2021 survey. You can receive personalized survey results and you’ll have the chance to win an incredible prize.

Help us to gather insights about trends in the C++ community. Participate in the survey run by JetBrains and you’ll have the chance to win a prize! In addition, you can receive personalized survey results to compare yourself with other developers.

Fill it the survey!

A Recap on string_view--Jonathan Boccara

Back to the basics.

A Recap on string_view

by Jonathan Boccara

From the article:

The string capabilities of C++ have little evolved since C++98, until C++17 brought a major evolution: std::string_view.

Let’s look at what string_view is about and what it can bring to your code, by making it more expressive and making it run faster...

Complete C++20 Modules Support with GCC--Boris Kolpackov

More of c++20 ready to be used.

Complete C++20 Modules Support with GCC

by Boris Kolpackov

From the article:

build2 now provides conforming and scalable support for all the major C++20 Modules features when used with GCC. This includes named modules, module partitions (both interface and implementation), header unit importation, and include translation. All of these features are also supported in libraries, including consumption of installed libraries with information about modules and importable headers conveyed in pkg-config files. As part of this effort we have also created a collection of examples that demonstrate C++20 Modules features that impact the build process...

Take control of your vcpkg dependencies with versioning support--Victor Romero

A new feature.

Take control of your vcpkg dependencies with versioning support

by Victor Romero

From the article:

We have an exciting new feature to announce in vcpkg: the long-awaited and highly requested package versioning! This feature makes it possible to install specific versions of dependencies and control installed versions over time. In order to use this feature, a vcpkg.json manifest file must be present in your repo to declare dependencies. Versioning is not currently available for libraries installed via the command line (i.e. vcpkg install library_name commands). The versioning feature is completely optional – you can choose not to specify library versions, and vcpkg will pick the most appropriate set of compatible versions for your dependencies from its baseline catalog. For now, we are considering this feature experimental. Please give us your feedback and let us know how we can improve...

Introduction to GPU Programming with CUDA and Thrust -- Richard Thomson

Utah C++ Programmers has released a new video from their February meeting.

Introduction to GPU Programming with CUDA and Thrust

by Richard Thomson

From the video description:

High-performance computing is now dominated by general-purpose graphics processing unit (GPGPU) oriented computations. How can we leverage our knowledge of C++ to program the GPU?

NVIDIA's answer to general-purpose computing on the GPU is CUDA. CUDA programs are essentially C++ programs, but have some differences. CUDA comes as a Toolkit SDK containing a number of libraries that exploit the resources of the GPU: fast Fourier transforms, machine learning training and inference, etc. Thrust is a C++ template library for CUDA.

In this month's meeting, Richard Thomson will present a brief introduction to CUDA with the Thrust library to program the GPU.

Programming the GPU with CUDA is a huge topic covered by lots of libraries, tutorials, videos, and so-on, so we will only be able to present an introduction to the topic. You are encouraged to explore more on your own!

YouTube: https://www.youtube.com/watch?v=tbb835UFRQ4

Preconditions, Postconditions, Invariants - How They Help Write Robust Programs

An introduction to preconditions, postconditions and invariants.

Preconditions, Postconditions, Invariants –- How They Help Write Robust Programs

by Andrzej Krzemieński

From the video description:

Preconditions, postconditions, and invariants are part of what is often called Design by Contract, or Contract Programming. Even if you haven't heard of them, you are probably using them already. In this talk, we are going to see what they are, and how people and tools can make use of them.

unique_ptr, shared_ptr, weak_ptr, or reference_wrapper for class relationships -- Hitesh Kumar

Expressing class relationships with unique_ptr, shared_ptr, weak_ptr, and reference_wrapper.

unique_ptr, shared_ptr, weak_ptr, or reference_wrapper for class relationships

by Hitesh Kumar

From the article:

Classes communicate with each other by having handles as members that refer to other classes. The choice of those referring-handles (e.g., pointers or references) is mostly driven by ownership or control-over-lifetime semantics.

Why PVS-Studio Uses Data Flow Analysis: Based on Gripping Error in Open Asset Import Library

An essential part of any modern static code analyzer is data flow analysis. However, from an outside perspective, the use of data flow analysis and its benefit is unclear.

Why PVS-Studio Uses Data Flow Analysis: Based on Gripping Error in Open Asset Import Library

by Andrey Karpov

From the article:

It all started with checking the latest version of the Qt 6 library. There was a separate usual article on this, where I'd described 77 errors found. It turned out that at first, I decided to flip through the report, not excluding the third-party libraries' warnings. In other words, I didn't exclude the warnings related to \src\3rdparty in the settings. It so happened that I immediately ran up against a gripping error example in the Open Asset Import Library. So, I decided to write this extra little note about it.