Category C++

Enum Enum: Only A Muppet Would Use The Old Form

I always found the handling of enumerated types in the original C++ standard to be a weak point of the language. Generally, wherever braces are used a new level of scope is defined… except in the case of enums it would seem. For example, it is not unreasonable to expect the following to compile without […]

A std::promise means nothing until it’s delivered.

I have really enjoyed reading Anthony Williams’s C++ Concurrency in Action and highly recommended it if you want to get up to speed on the new threading support provided in the C++11 standard. However, I did run into trouble on my first reading when, after the explanations of std::thread and the use of join() or […]

News From The Rebel Alliance

I finally got around to watching Herb Sutter’s much promoted Future of C++ webcast that went out live last Friday on MSDN’s Channel 9. The talk began with an update on Visual C++ detailing the work to include the remaining missing C++11 features. There seems to be criticism on some of the forums that no […]

Models of Threaded Programming: Pipeline

While studying David Butenhof’s classic Programming with POSIX Threads I sketched out the following diagram to help me visualize the example ‘Pipeline’ threading model (for which he provides the source code in Chapter 4). I have simplified this somewhat (for example, as is standard practice, the predicate is actually checked both before and after the […]

The Three Amigos: C++ And Beyond 2012

Channel 9 have just posted up a Q&A session filmed at the end of this years ‘C++ And Beyond’ conference. This features, of course, the ‘three amigos’: Andrei Alexandrescu, Scott Meyers, and Herb Sutter. Actually they seem to have now been renamed the ‘big three’… maybe they don’t actually like each other that much! What […]

Visual Studio Visualizers: I Can See Clearly Now…

An important aspect of modern C++ programming is the use complex data types, whether sourced from the Standard Library, Boost or other third party libraries. This can lead to difficulties during debugging when these objects are not correctly represented in the debugger variable windows. As my own personal debugging ‘experience’ was being hampered as a […]

Singularity Pattern: Only one, there can be. Yes.

There is already an overwhelming amount of blogging and online articles on the subject of Singletons. These generally cover the issues of Why Singletons are Evil and, if so, what we should be using instead. To remind ourselves, by definition (GoF), a Singleton must: a) Ensure that only one instance of a class is created. […]