Monthly Archives: July 2011

Discriminated Unions

In computer science, a discriminated union is one of the many names given to the concept of a “catch-all” datatype. (You’ll also hear it referred to as a variant.) It’s meant to hold data of any type at any given … Continue reading

Posted in C/C++ | Tagged , | 6 Comments

Opaque Data Pointers

Most of the frameworks that I work on need to be usable from multiple programming languages (typically, C++, C# and Objective-C, but sometimes more). This means I must target the lowest common denominator in terms of the function prototypes, so … Continue reading

Posted in Framework Design | Tagged , | 8 Comments

Inline Namespaces

One of the neat, new language features of C++0x that is targeted firmly at framework designers is the ability to declare “inline” namespaces. While the name may seem a bit strange at first, the concept is quite intuitive. It allows … Continue reading

Posted in C/C++, Framework Design | Tagged , | 4 Comments

Returning Stack-Based Values

The code looks innocuous enough, but something as simple as this can be the source of hard to track down bugs. I want to talk a bit about the dangers of returning stack-based values.

Posted in Framework Design | Tagged , | 4 Comments

Exceptions in Frameworks

Exceptions are a topic near and dear to my heart, mostly because I have some strong opinions about the benefits and disadvantages of exceptions. But this isn’t a blog posting about whether exceptions are good or not. Instead, this is … Continue reading

Posted in Framework Design | Tagged | Leave a comment

Warning: Don’t Ignore Warnings!

How many times have you run across code that looks fine, works fine, but still generates a message like “Signed/unsigned mismatch” when we compile it? How many times have you thought to yourself, “that’s stupid, I know this code is … Continue reading

Posted in C/C++ | Tagged , , | Leave a comment

Calling Instance Methods in WMI

It’s pretty rare that I wind up using WMI from a C++ application, but when I’ve done so in the past, it’s been a straightforward process. The documentation in MSDN is generally adequate, and their example projects tend to lead … Continue reading

Posted in Win32 | Tagged | 3 Comments

Reconstructing a Corrupted Stack Crawl

For my day job, I frequently look at reports that come out of WinQual from Microsoft. These reports contain crash dumps that I can use to determine what’s going wrong with the software I’ve been working on. All in all, … Continue reading

Posted in Win32 | Tagged , , | 4 Comments

Move Semantics

One of the new features in C++0x is a way to express move semantics. This is a sensible piece of sibling functionality to copy semantics, which you’ve likely already run into. When writing copy semantics for a class, the idea … Continue reading

Posted in C/C++ | Tagged , | Leave a comment