Category Archives: C & C++

Radical Refactoring: Breaking Changes

One of the most common sources of bugs is ambiguity: some too-subtle API change that’s missed in a library update and introduces a subtle bug, that finally only gets found out in the field. My answer to that problem is … Continue reading

Posted in Anecdotes, C & C++, C++ for the self-taught, Embedded software development, Radical Refactoring | Comments Off

Radical Refactoring: Have the compiler to (some of) the reviewing

One of the most common sources of bugs is ambiguity: some too-subtle API change that’s missed in a library update and introduces a subtle bug, that finally only gets found out in the field. My answer to that problem is … Continue reading

Posted in Anecdotes, C & C++, C++ for the self-taught, Embedded software development, Radical Refactoring | Comments Off

Optimization by puzzle

Given a query routine that takes a name and may return several, write a routine that takes a single name and returns a set of names for which each of the following is true: For each name in the set, … Continue reading

Posted in Algorithms, C & C++, C++ for the self-taught, Software Design, Software Development, Software Engineering | 1 Comment

Optimizing with type lists

In this post, I will take a brief look at how using type lists can help optimize certain applications.

Posted in C & C++ | Comments Off

A functional version of the KMP algorithm

For one of the projects I’m working on, I needed a compile-time version of the KMP algorithm in C++. I started by making the algorithm functional.

Posted in C & C++, Software Development | Comments Off

Run-time composed predicates and Code generation

While working on Arachnida, preparing version 2.2 due out this fall, one of the things we’ll be introducing is a hardened OpenSSL transport-layer-security plug-in, to replace the one we’ve had for the last seven or so years. One of the … Continue reading

Posted in C & C++, C++ for the self-taught, Software Design | Comments Off

Sometimes, your right hand should know what your left hand is doing

Especially if you’re a compiler…

Posted in C & C++, Software Development | Comments Off

Conditional in-place merge algorithm

Say you have a sorted sequence of objects. Go ahead, say: “I have a sorted sequence of objects!” Now say it’s fairly cheap to copy those objects, you need to be space-efficient and your sequence may have partial duplicates — … Continue reading

Posted in C & C++ | Tagged | Comments Off

Structure alignment and padding

In my previous post on the subject, I talked about using magic numbers and versions, alignment, and later added a note about endianness after a suggestion from Michel Fortin. This time, I’ll talk about padding, how the sizeof operator can … Continue reading

Posted in C & C++, Embedded software development, Software Development | Comments Off

Minor changes in style

I am not usually one to make much of a fuss about coding style: as long as the code is easily readable, I don’t much care whether you use tabs or spaces to indent, how you align your curly quotes, … Continue reading

Posted in C & C++, Software Development | Comments Off