Position-independent code (PIC) and Position-indendendent executables (PIEs) are nothing new, yet they are still a bit obscure compile toggles that you ignore until you can’t. Luckily for my readers, I had too un-ignore them to make things work. Here’s the after action report.
Last week I was stuck chasing an annoying bug. You know the kind: random crash, happens about once every 20 or 30 runs when the CI runs unit tests, can’t be reproduced by hand, doesn’t show-up on Valgrind…
Package management and build systems are one of the next big challenges C++ is going to face. In this article series, I offer some thoughts and ideas to solve that. This post is the second part, where we talk about toolchain definition, how a standard could work and what challenges it would face.
Christmas and New Year Eve are that particular part of the year when we wish for impossible things and make unreasonable promises. Get a bottle of a 1999 DRC La Tâche, lose weight, have a C++ ecosystem with a built-in package manager…
A quick follow-up on the previous article ‘Better polymorphic ducks’ to address two small issues.
Peer reviews are a great source of insight. This is why we do code reviews and talks rehearsals. Blog posts are no exceptions and my astute readers pointed two things in the previous article Better polymorphic ducks that I will now share with you.
In a previous post we discussed how to combine duck typing with runtime polymorphism. A polymorphic duck if you will. Today let’s see how we can improve on our original design to remove some limitations.
The use of the TEPS (Type Erasure (Sean) Parent Style) we have shown in the first part of this series gave us what I call a Polymorphic Duck: something that can walk like a duck and quack like a duck, but it not necessarly inherited from a base Duck class. Moreover, the quack() and walk() are expected to be free function, not methods, which allows for looser coupling (especially if they take arguments that have nothing to do with the duck itself).
It’s no secret C++ favours static polymorphism. But sometimes, runtime polymorphism is needed and suddenly we find ourselves down the virtual rabbit hole. Do not despair, for there are ways to avoid this madness.
I hate the virtual keyword. Inheritance fills me with a sense of dread. I can always quote half a dozen technical reasons to explain it. People much more smarter than me have discussed why it’s the worst form of composition.