Category Archives: programming
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
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
This post is to inform you about a bug in GCC that may cause memory (or other resource) leaks in your valid C++ programs.
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
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
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