Tag Archives: type system

More const — fewer bugs

I have just read article “Please declare your variables as const” by Bartłomiej Filipek. It argues that declaring your variables const is beneficial for reasons other than performance. In particular, it can help find bugs in your code. Now, let … Continue reading

Posted in programming | Tagged , , | 6 Comments

Another polymorphism

In this post we will try to see by a practical example what Boost.Variant is for. You can sometimes see examples that use type variant<int, double, string>, but to me they are artificial: I never needed to use something that … Continue reading

Posted in programming | Tagged , , , , , | 19 Comments

Overload resolution

This post is an introduction to another one that I intend to write in the future. The goal of this one is to go over the concepts of function template specialization, function (template) overloading, argument dependent lookup (ADL) and overload … Continue reading

Posted in programming | Tagged , , , , | 16 Comments

More than you need

The classes you design can do more (in terms of allowed operations) than what you could figure out from just looking at their member function declarations. The C++ Standard defines a number of cases where certain expressions involving your type … Continue reading

Posted in programming | Tagged , , , , , | 14 Comments

Efficient optional values

In this post we will see a library for storing nullable/optional values that can in certain situations replace and outperform Boost.Optional.

Posted in programming | Tagged , , , , | 4 Comments

Handling short codes — part II

Today, we will continue with the implementation of a type capable of storing short codes. For the previous post on the subject see here. This time, we will focus on type safety.

Posted in programming | Tagged , , | 5 Comments

Bug of the week

Today we are going to see a case study illustrating a bug. Not a very spectacular one: a typical bug one would encounter in everyday work. We will start with the symptoms, identify the root cause, and suggest measures to … Continue reading

Posted in programming | Tagged , , | 11 Comments