Articles & Books

Talks and Speaker for Meeting C++ 2022 released

Since yesterday its possible to have a first look at the program of Meeting C++ 2022

A first view on the talks and speakers of Meeting C++ 2022

by Jens Weller

From the article:

I'm excited to release this update for Meeting C++ 2022: the talks and speakers for this years conference!

As you can see in the talk listing, this is still an ongoing process, getting the speaker pictures from the new speakers for this year will still take a while. Creating the schedule will also take a few weeks, as of now Tracks A and B are planned on site, with Tracks C and D being part of the online part.

Improved automated instance construction in C++--Marius Elvert

The series continue.

Improved automated instance construction in C++

by Marius Elvert

From the article:

In my last blog post, I wrote about how I am automatically deducing constructor parameters in my dependency injection container. The approach had a major drawback: It worked only for 2 or more parameters, since there was an ambiguity with copy- or move-constructors with exactly one parameter...

Why do arrays have to be deleted via delete[] in C++

This note is for C++ beginner programmers who are wondering why everyone keeps telling them to use delete[] for arrays. But, instead of a clear explanation, senior developers just keep hiding behind the magical "undefined behavior" term. A tiny bit of code, a few pictures and a glimpse into nuts and bolts of the compilers – if interested, you're welcome to read.

Why do arrays have to be deleted via delete[] in C++

by Mikhail Gelvih

From the article:

This pointer in no case should be passed to the usual operator delete. Most likely, it will just remove the first element of the array and leave the others intact. Note that I wrote "most likely" for a reason, because no one can predict every possible outcome and the way the program will behave. It all depends on what objects were in the array and whether their destructors did something important. As a result, we get the traditional undefined behavior. This is not what you would expect when trying to delete an array.

C++23’s Deducing this: what it is, why it is, how to use it

Useful new feature!

C++23’s Deducing this: what it is, why it is, how to use it

by Sy Brand

From the article:

Deducing this (P0847) is a C++23 feature which gives a new way of specifying non-static member functions. Usually when we call an object’s member function, the object is implicitly passed to the member function, despite not being present in the parameter list. P0847 allows us to make this parameter explicit, giving it a name and const/reference qualifiers...

Pass-by-value vs Pass-by-reference--James Mitchell

Complex world.

Pass-by-value vs Pass-by-reference

by James Mitchell

From the article:

Let’s dig into the age old question, should you pass-by-value or pass-by-reference in C++? (or by pointer in C)

This blog post is mostly a re-post of a reddit comment that I made on r/cpp about pass-by-value and pass-by-reference, with some minor improvements, to make it easier to reference and save.

The answer isn’t as easy as it might seem, it depends on the Application Binary Interface (ABI) and your use-cases, there isn’t a one size fits all answer, this is even more the case for anything which is built to be cross platform.

First it’s probably good to break the problem down into two parts (focusing solely on performance, ignoring readability and maintainability which should often be more important)

  • The language construct costs (copying, moving, etc)
  • Compiler implications (aliasing, pointer provenance, etc)
  • The ABI (the stack, registers, etc)...