Category Archives: programming

as the name implies…

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 , , | 29 Comments

(Not) detecting bugs

The following code contains a bug. A developer has spent quite some time looking for the source. The intent of this code is to iterate over two vectors simultaneously, from the first up to the one-before-last element. Thus the most … Continue reading

Posted in programming | Tagged , , , , | 3 Comments

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 , , | 9 Comments

Concealing bugs

Consider the following piece of program code. This program is expected to open file contents.txt, read names from it; then find a desired name, and do something with it. But the program will not do it, because I have a … Continue reading

Posted in programming | Tagged , , , , | 21 Comments

The One-Definition Rule

We have been hit by the same bug twice already this year. It ends in a crash, and it took developers days to find it (in each case), even though it is reproducible on each run of unit tests. The … Continue reading

Posted in programming | Tagged , , | 14 Comments

Concepts Lite vs enable_if

This post contains quite advanced material. I assume you are already familiar with Concepts Lite. For an overview of what Concepts Lite is, I recommend this proposal. Also, I have found this blog very useful regarding the details of and … Continue reading

Posted in programming | Tagged , , , | 9 Comments

Is constructible?

Today I want to share with you something that really surprised me. Currently, Tomasz Kamiński and Ville Voutilainen are working on fixing a certain issue with std::optional’s converting constructors (which deserves a separate post). At some point, in the solution, … Continue reading

Posted in programming | Tagged , , | 12 Comments