Category Archives: programming

as the name implies…

Your own error condition

In the previous post we have seen how you can create your own error-code enumeration for representing different reasons for failure in your component, and how you can store them and convey them type erased via std::error_code. In this post … Continue reading

Posted in programming | Tagged , | 5 Comments

Your own error code

I was recently implementing the “classification of error conditions” in my application offered by the functionality behind std::error_code. In this post I want to share some of my experience and insight. C++11 comes with a quite sophisticated mechanism for classifying … Continue reading

Posted in programming | Tagged , | 6 Comments

Compile-time string concatenation

We will start with a bug, taken from real life. It spans across three files: Question: what happens when this program is executed?

Posted in programming | Tagged , , , , , | 9 Comments

Asserts in constexpr functions

Assertions (like C-style macro assert) are not an ideal, but still useful tool for indicating assumptions about program correctness, and help finding programmer bugs. In this post we will see how we can use assertions in constexpr functions. This works … Continue reading

Posted in programming | Tagged , , , , | 8 Comments

The GCC bug affects you

This is a follow-up to my previous post about a bug in GCC. I was reading comments, and observed that some readers say that the example I used is rare, or artificial, or that it does not follow “good programming … Continue reading

Posted in programming | Tagged , , | 8 Comments

A serious bug in GCC

This post is to inform you about a bug in GCC that may cause memory (or other resource) leaks in your valid C++ programs.

Posted in programming | Tagged , | 21 Comments

Toggles in functions

Have you ever seen a function call like this? We are processing something: this should be clear from the context. But what do these parameters mean? What is true and what is false? From the function call we will never … Continue reading

Posted in programming | Tagged , , | 31 Comments