Tag Archives: gotchas

error codes — some clarifications

In this post I would like to discuss two issues brought up by the readers regarding previous posts on using <system_error>: Storing 0 in error codes, and using non-0 success values. Concerns about using globals. Advertisements

Posted in programming | Tagged , , | 1 Comment

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 , , | 10 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 , | 27 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

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

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

The cost of std::initializer_list

C++ aims to be a language for people working close to metal. It offers abstractions that cost no (or minimum) run-time or memory overhead. If you require zero-overhead abstractions, std::initializer_list may not be a tool for you.

Posted in programming | Tagged , | 21 Comments