Articles & Books

Contracts, Preconditions & Invariants -- Andrzej Krzemienski

"Contract support" is one of the things actively developed for C++.

Contracts, Preconditions & Invariants

By Andrzej Krzemienski

About the article

This blog post is an introductory material, demonstrating what a contract is, how preconditions and invariants can be derived from the contract, and how this process can help detect bugs. Two points stressed in this post are: (1) preconditions and invariants are not “contracts” and (2) only a subset of contract-related bugs can be detected through preconditions and invariants.

Inheritance Without Pointers--Jonathan Boccara

What do you think?

Inheritance Without Pointers

by Jonathan Boccara

From the article:

Inheritance is a useful but controversial technique in C++. There is even a famous talk by Sean Parent called Inheritance is the base class of evil. So inheritance is not the most popular feature of the C++ community.

Nevertheless, inheritance is useful, and widely used by C++ developers.

What is the problem of inheritance? It has several problems, and one of them is that it forces us to manipulate objects through pointers...

Inlining and Compiler Optimizations--Scott Wolchok

The complicated world of optimisations.

Inlining and Compiler Optimizations

by Scott Wolchok

From the article:

Why is inlining so important in C++? Clearly, it reduces function call overhead: if a function is inlined, there is no need to spend time setting up its arguments, jumping to it, creating a stack frame, and then undoing all that upon returning. More interestingly, though, inlining enables other compiler optimizations. In this article, I will show examples of constant propagation and loop-invariant code motion (LICM). Then, I will explain how inlining enables these optimizations to apply more widely and show an example of the consequences when that doesn’t happen...

Semaphores in C++20--Rainer Grimm

A new useful construct in the standard library.

Semaphores in C++20

by Rainer Grimm

From the article:

Semaphores are a synchronization mechanism used to control concurrent access to a shared resource. They also allow it to play ping-pong...