When is Unicode not Unicode? When Microsoft gets involved!

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode? They will have you believe that Unicode requires you to use a WCHAR (wide) character type and that Unicode cannot be represented by a CHAR (narrow) character type. In fact, […]

C++ Catching exceptions in constructors

When deciding whether to catch the exception, especially one thrown during construction, ask yourself a very simple question, if you do catch it can you still leave the class in a usable state? If the answer is yes, then by all means catch it, deal with it and allow construction to continue. If the answer […]

C++ Throwing exceptions from destructors

You’re implementing a beautiful class. It’s just wonderful – the most perfect code you’ve ever written, except… for some reason it keeps crashing and you don’t know why. You’ve debugged the code and discovered it happens when your class goes out of scope and needs to throw an exception from the destructor. Tested in isolation, […]

Bloodlines and casting

When working with objects that have an inheritance model you basically have an inverted tree that represents your object hierarchy. Contrary to a normal everyday trees, an inheritance tree has its root at the top. In other words, the root of the tree represents the base class and anything below it represents a more derived […]

Geo-indexing problem

Imaging you have a map and on that map you define a bunch of geo-locations; polygons, which are defined by their vertices as latitude and longitude co-ordinates. These geo-locations may overlap and may either be very big or very small (or in-between).  The problem is to figure out, for any point on the map, which […]

Doubt and uncertainty!

The C and C++ standards documents can be a bit of a beast to trawl through and quite often you’ll find yourself reading the same sentence a number of times trying to fathom out what it is actually saying. It’s just like when you read the EULA for a software product; lots of big words […]

Technical Debt

Regular readers (do I actually have any, I wonder?) of my blog may be wondering why I’ve not posted any new content for the last few weeks. First off, let me apologise for this. Secondly, let me explain why: I’ve been busy… in my new job! That’s right, ladies and gentlemen, everyone’s favourite evil one […]

Building Boost on Windows

In case you’ve never heard of it before, Boost is a set of peer reviewed libraries for C++. They provide a lot of features that are sorely missing from the standard C++ libraries and are probably the closest C++ developers have to a standard development toolkit. In fact, Boost is so useful that a number […]