Developer blog

Trip Report: Fall ISO C++ Meeting in Wrocław, Poland

November 29th, 2024

— by Jonathan Müller

Last week, I attended the fall 2024 meeting of the ISO C++ standardization committee in Wrocław, Poland. This was the fifth meeting for the upcoming C++26 standard and the feature freeze for major C++26 features. For an overview of all the papers that made progress, read Herb Sutter's trip report. Contracts and profiles are the big ticket items that made the most progress this meeting. Contracts is forwarded to wording review, while still being fiercely opposed by some. Profiles is essentially standardized static analysis to improve memory safety, although some deem it ineffective. Due to various scheduling conflicts I did not attend any of the relevant discussions in these spaces. Instead, I am going to share my thoughts about ranges, relocation, and reflection.

Read more

if constexpr requires requires { requires }

October 23rd, 2024

— by Jonathan Müller

Probably the two most useful features added to C++20 are `requires` and `requires`. They make it so much easier to control overload resolution, and when combined with `if constexpr` in C++17, they allow basic reflection-based optimizations in templates. While `requires requires` has gotten a lot of (negative?!) press for controlling overload resolution, its cousin `requires { requires }` is a bit overlooked.

Read more

Trip Report: Summer ISO C++ Meeting in St. Louis, USA

July 12th, 2024

— by Jonathan Müller

Two weeks ago, I attended the summer 2024 meeting of the ISO C++ standardization committee in St. Louis, USA. We made progress on a lot of features for C++26, but I have some thoughts about senders/receivers, reflection, and the idea of introducing borrow checking to C++.

Read more

Trip Report: C++Now 2024

May 8th, 2024

— by Jonathan Müller

Last week, I've attended C++Now 2024 and it was definitely one of the best conferences I've ever been to!

Read more

Trip Report: Spring ISO C++ Meeting in Tokyo, Japan

March 27th, 2024

— by Jonathan Müller

Last week, I attended the spring 2024 meeting of the ISO C++ standardization committee in Tokyo, Japan. We made progress on a bunch of interesting features for C++26.

Read more

I'm the new assistant chair of SG 9, the study group for std::ranges!

March 8th, 2024

— by Jonathan Müller

In a week, the C++ standardization committee is meeting in Tokyo, Japan, to continue work on C++26. It will be my first meeting with an official role as assistant chair of SG 9.

Read more

Parsers vs Unicode

February 22nd, 2024

— by Arno Schödl

We think that keeping parser libraries Unicode-agnostic is the way to go.

Read more

Detecting multiple instantiations

January 24th, 2024

How can a function know if it already has been instantiated before? Ideally this detection should happen during compilation. However, this is not possible in all cases. In this post we dive into stateful metaprogramming and throwing errors before main.

Read more

Enforcing that static local variables only exist once

December 27th, 2023

— by Bernardo Sulzbach

C++ static local variables offer a good solution for some pertinent engineering problems. However, with code getting increasingly more generic, it’s too easy to end up with multiple instances of what should have been a singleton. To fix that, we came up with a zero-cost, compile-time check that a static local variable is instantiated at most once in the whole program.

Read more

C++ needs undefined behavior, but maybe less

November 20th, 2023

— by Jonathan Müller

The C++ standard does not specify all behavior. Some things are up to the implementation, while other operations are completely undefined, and the compiler is free to do whatever it wants. This is essential for some optimizations but can also be dangerous. The newly proposed erroneous behavior addresses it, but it cannot be used to eliminate all undefined behavior.

Read more

By Default Different

September 28th, 2023

— by Arno Schödl

Sometimes, you need to register a name with your environment, like a named mutex to be shared across processes, a Win32 user-defined message or a file name for shared memory backing. And you must make sure that it does not clash with someone else's name - and that someone else could be you!

Read more

Compile-time sizes for range adaptors

August 29th, 2023

— by Jonathan Müller

For some ranges, like std::array<T, N>, the size is known at compile-time. Range adaptors like transform don't change the size of the underlying range, so they should conditionally provide the size at compile-time as well. How do we implement that without causing code duplication with the existing .size() member function that provides the size at runtime?

Read more

The new static constexpr std::integral_constant idiom

August 7th, 2023

— by Jonathan Müller

If your type provides a property with a compile-time known value (like the size of a std::array), consider using a static constexpr std::integral_constant member for it. This allows multiple convenient access syntaxes with only a single declaration.

Read more

Should we stop writing functions?

July 25th, 2023

— by Jonathan Müller

... and use named lambdas instead? This prevents ADL, gives you more control over overloading, and template parameters. The standard library has started using it in places, should we?

Read more

Event or no Event?

July 13th, 2023

— by Arno Schödl

We have a cross-platform UI library with widgets. UI widgets by nature serve two masters: The code using them wants to style them and prepopulate their content. The user using them wants to interact with them and modify their content. Therefore, widgets typically offer functions to modify their properties, including the content, and also events that notify about content changes. For example, an edit box may offer a SetText function and a OnTextChange event. Here is the question: If SetText modifies the text, should the OnTextChange event fire?

Read more

Constrain your user-defined conversions

July 5th, 2023

— by Jonathan Müller

By default, user-defined conversion operators allow additional standard conversions afterwards. We can and should disable that by turning it into a constrained template.

Read more

Trip report: Summer ISO C++ Meeting in Varna, Bulgaria

June 19th, 2023

— by Jonathan Müller

The ISO C++ committee met in Varna, Bulgaria last week to start in C++26. Jonathan shares his experience.

Read more

Don‘t Make a Hash of it

April 25th, 2023

— by Arno Schödl

Composing streaming hashes has its pitfalls. Treat it like serialization to avoid them.

Read more

Meaningful Exceptions

March 31st, 2023

— by Arno Schödl

There are many APIs which on error throw exceptions. Or we write wrappers that turn error codes into exceptions. Is that a good idea?

Read more

An Actually Helpful Character Type

March 5th, 2023

— by Arno Schödl

As we have seen last time, having char8_t is not terribly useful. But we discovered that another character type is actually quite useful.

Read more

char8_t Was a Bad Idea

February 20th, 2023

— by Arno Schödl

We recently pondered whether to change all our chars to C++20 char8_t and decided against it, at least for now. At the face of it, adding char8_t seems straight-forward and appealing. There is already a char16_t and char32_t for UTF-16 and UTF-32 strings, so why not have a char8_t for UTF-8 strings?

Read more

Evil Reentrance

February 6th, 2023

— by Arno Schödl

Everyone knows parallel programming is hard, and we talk about it a lot. We talk much less about which I think of as the little brother of parallel programming and also a popular source of bugs in complex systems: reentrance.

Read more

The Merits of optional<T const&>

January 23rd, 2023

Passing function parameters by const& is very common. Now, what do we do if such a parameter is optional? std::optional does not allow T to be a reference.

Read more

When Order Matters

January 10th, 2023

— by Arno Schödl

Last time, I talked about inlining of single-call functions. In fact, there are situations where even for functions called multiple times, inlining functions into a larger one is beneficial.

Read more

Always Inline Single-Call Functions

December 30th, 2022

— by Arno Schödl

Conventional coding rule wisdom says that functions can be too long and then must be broken into shorter ones. In this post we discover distinct disadvantages when it comes to reading and refactoring which we have not seen discussed elsewhere.

Read more

Poor Man's Exception

December 19th, 2022

— by Arno Schödl

Let’s say we are performing a sequence of operations. Now, let’s assume each operation can fail, and returns false if it does. And if an operation fails, we want to abort and skip all subsequent operations. This post explores an alternative to if-cascades and exceptions to implement this.

Read more

The Value of Canonical Code

December 7th, 2022

— by Arno Schödl

Often there are different ways of how to write a particular piece of code. It is a good idea to have agreement on which code to pick. At think-cell, we call this the canonical solution. In this post we discuss how to find it and why this is important.

Read more

Properties (2)

November 30th, 2022

— by Volker Schöch

Meet the concept of hidden state: We define hidden state as state (information) that is represented and maintained in a data structure, but is not discernible by the user. Everybody who designs data structures frequently meets hidden state, whether they like it or not.

Read more

Properties (1)

November 23rd, 2022

— by Volker Schöch

Let's talk about a useful data structure for fonts. For the sake of this article, let's assume that a font consists of just a font face, a size and a flag for boldness. Turns out that even this simplified view of fonts is very useful in many use cases we encounter in our software.

Read more

tc::change

November 16th, 2022

— by Arno Schödl

Welcome to this blog of our development work at think-cell. It will be mainly about programming in general and more specifically about C++. Our platforms are mainly Windows and macOS, with a bit of web development sprinkled in. We will write about anything that comes to our mind, architectural decisions, little nuggets of wisdom we found or rants about bugs in 3rd party software that leave us frustrated. I want to get started with a little utility that proved surprisingly useful for us and that has a bit more thinking behind it than is apparent at first sight.

Read more


Sign up for blog updates

Don't miss out on new posts! Sign up to receive a notification whenever we publish a new article.

Just submit your email address below. Be assured that we will not forward your email address to any third party.

Please refer to our privacy policy on how we protect your personal data.

Share