Iterating over the elements of a recursive data structure can be difficult. Given a set of objects, where each object could potentially link to any other object, how do we visit each […]
A curious non-OOP virtual inheritance for a GPU
A new technology I’m trying has a curious domain-specific extension for OpenGL graphics. It introduces a block concept allowing for modular shader code. From a language standpoint I was uncertain what to […]
Wait-free queueing and ultra-low latency logging
To support a low-latency trading system I needed a logging call that had minimal impact on the calling thread. It was imperative to be responsive to market events at all times. My […]
The uninitialized variable anathema: non-deterministic C++

A variable with an undefined value is a terrible language failure. Especially when programs tend to work anyway. It’s a significant fault of C++ to allow this easy-to-create and hard-to-detect situation. I […]
The Infernal Loop Iterator
Collection iteration is perhaps the most insidious language construct. Simple to create and easy to understand. Yet lurking within lies the ability to create random non-local defects. Monstrous bugs that you’ll spend […]
Strings and Text are not the same
Thinking of text and strings as the same type is wrong. It leads to all kinds of errors and results in confusing or incomplete APIs. I wrote before that the string type […]
Simulating the way to victory: Bloons TD Battles
Simulations can provide curious insights; in this case a distinct advantage to winning a game. I recently encountered a perfect opportunity to run a simulation on the game “Bloons TD Battles”. There […]
Painlessly add a virtual to a large class structure
Add a new virtual to a large object hierarchy Adding a new function to a complex class structure is arduous. A starting point is hard to find in a web of many […]
The string type is broken
My previous article, “We don’t need a string type“, caused a bit of stir. Though the feedback is mixed, there is a common theme of a string being a useful feature. After […]
Bridging __VA_ARGS__ to C++ variadic templates
Variadic templates are a great new feature of C++, yet they can be a bit confusing. __VA_ARGS__ are also a nice feature of the preprocessor, yet it has a few oddities. These […]
Are explicit namespaces required?
I’m working on modules in Leaf, implementing namespace support. The moment I write my first test a feeling of uneasiness sets in. As I stare at the sample code I see a […]
The true cost of zero cost exceptions
Exceptions are a cornerstone of programming. If we intend to use them prolifically, as in C++, we need an efficient implementation. Thus was born the zero-cost exception model. It offers zero runtime […]
We don’t need a string type
Should string be a distinct type or merely an alias for an array of characters? I’m considering the options for Leaf and can’t convince myself that a specialized type is needed. Looking […]
Safely using enable_shared_from_this
Obtaining a ‘shared_ptr’ from ‘this’ is possible using the ‘enable_shared_from_this’ class. It’s a feature that allows a class to reference itself within a smart pointer based API. Beware an ugly implementation detail […]