Jonathan Boccara's blog

A new post every Tuesday and Friday morning

Return value optimizations

Published a few months ago - 1 Comment

In Make your functions functional, we saw that it was preferable to have functions return objects by value, for code clarity. Now to avoid incurring performance costs by doing this, the compiler can optimize away the copies related to the return by value, if you respect a few simple rules. This post describes these optimizations and shows […]

Clearer interfaces with optional<T>

Published a few months ago - 0 Comments

The need for representing a value that is “empty”, “null”, or “not set” arises regularly in code but often leads to clumsy or brittle solutions. This need may appear with a function that needs to return a value but may not be able to compute it in all cases. In this case, several solutions are […]

Make your functions functional

Published a few months ago - 5 Comments

Introduction : global variables Global variables are a Bad Thing. Everyone knows this, right ? But do you know exactly why ? I have asked this question around, and many of us can’t exactly explain why global variables should be avoided. It is not a question of scope. Indeed, global constants have the same scope as […]

How I came to create Fluent C++

Published a few months ago - 3 Comments

Getting better by teaching I’ve quite recently come to the realization of the immense value of teaching. Not teaching as in formal education, but rather teaching as in explaining things to people, clearing the confusion around a topic, or simply sharing something I’ve learned. In a nutshell, when you teach, you get better at the topic […]

Becoming Fluent in C++

Published a few months ago - 1 Comment

Hi everyone! I’m Jonathan Boccara, your host on Fluent C++. The purpose of this blog is to study techniques to write expressive code in C++. By expressive code we mean code that expresses the intent of the programmer that wrote it. Code you can read and understand. Code that says what it means to do. […]