Development, Programming

I’ll just refactor that…

I originally posted this to #AltDevBlogADay on Saturday November 12, 2011. Refactor: Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.   I pretty much wish that word had never been invented. The above definition (taken from Martin Fowler’s Refactoring Home Page) seems to have… Continue reading I’ll just refactor that…

C++, FTL, Programming

A Different Allocator Model

I originally posted this to #AltDevBlogADay on Saturday 30th July 2011. Quite a few years back I started developing a custom STL implementation which has eventually be adopted and used throughout our company. One of the most important things to get right when developing any kind of generic container library is the way memory is allocated. It… Continue reading A Different Allocator Model

C++, FTL, Programming

Simplifying the Flag Set

In the last few posts, I’ve covered the development of a type safe and easy to use flag set, and as a result it now contains 3 required template parameters, two of which declare default values. template < typename TEnum, int TMaxFlags = 8, typename TNames = union_names<bit_set_size<TMaxFlags>::Value> > class flag_set The last two properties… Continue reading Simplifying the Flag Set

C++, FTL, Programming

Debugging Type Safe Flags

In the previous post I described how I implemented a type safe, template driven, system for declaring and using flags in C++. But one of the main issues with the solution was not being able to see what flags were set when debugging. Which Flags Are Set? When setting bits to store flags there are… Continue reading Debugging Type Safe Flags

C++, FTL, Programming

A C++ Flag Set Example

As was pointed out in the last post, I... ahem... forgot to actually put down some working examples of the flag set, so I ended up describing something but not actually showing off the final product. So I thought a good start would be to include a few of the flag set unit tests (since… Continue reading A C++ Flag Set Example

C++, FTL, Programming

Type Safe Flags in C++

Using bits and shifting enums is a pretty standard way of storing and reading flags. It's quick, it's compact and the syntax isn't to difficult to pick up for people who haven't seen it before. But since a bit is only a bit and an enum is only an enum it's far to easy to… Continue reading Type Safe Flags in C++

FTL, Programming

Deque Memory Management

I've wanted to blog more about our internal STL implementation for a while and one of the interesting things I wanted to cover was how we implemented the STL deque, which I think is a sometimes misunderstood and unfortunately not a very often used container. But first, what is a deque. A good place to start is… Continue reading Deque Memory Management

Programming, Unit Testing

Testing Objects with the Same Behaviour

One of the most difficult things when it comes to unit testing is cutting down on the number of duplicated tests. In the past I've often developed objects which have very different implementations but externally produce very similar results (for example when developing a vector compared to a fixed vector, or implementing different types of… Continue reading Testing Objects with the Same Behaviour

C++, Development, Programming

The Evils of Unity Builds

Unity builds. I don't like them. Of all the tools at your disposal to make a build faster, this is the worst. And it's not just the "hey let's #include .cpp files" weirdness, but the way that it can make a well structure, modular code base become worse than spaghetti junction at rush hour, and… Continue reading The Evils of Unity Builds

C++, Programming

Over-Thinking Helper Functions

SAFE_DELETE and SAFE_FREE. What do those functions (macros?) say to you? What if you also have over-ridden calls to DELETE and FREE too? I think most people see a safe delete function as one that handles a null pointer safely - only calling delete or free when the ptr isn't null. Since this is totally… Continue reading Over-Thinking Helper Functions