Monthly Archives: August 2011

Static Polymorphism in C++

One of my coworkers recently asked me to help him solve a problem he was having in code. He had a base class with several derived classes, and he wanted to add a static method to the base class, but … Continue reading

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

What Happens When You Load a Library

At this point in time, I think it’s safe to say that almost all programmers on Windows take shared libraries (DLLs) for granted. They’re this background thing that always “just works” (even if you do recall the ‘DLL hell’ days). … Continue reading

Posted in Win32 | Tagged | Leave a comment

Text Encodings for Cross-Platform Frameworks

When creating cross-platform frameworks, text encodings can be a hairy topic. There are multiple different encodings to choose from as well as edge cases to be concerned about. This post is going to cover some suggestions on how to handle … Continue reading

Posted in Framework Design | Tagged , , | 1 Comment

Crashing: Easy to Do When You Don’t Want to, Hard When You Do

The challenge: in C or C++, come up with a way to crash your application, running as little code as possible. It should be a cross-platform solution that works with any compiler, on any system, with any CPU architecture.

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

List Initialization

One of the new features in C++0x has been to make a consistent mechanism for initialization via a list. In previous versions of C++, it was inconsistent how you would initialize lists which would lead to a small amount of … Continue reading

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

How to Check Access Rights

Given that everyone is always pushing for better security mechanisms, I’m always surprised at how incredibly difficult the simple tasks can be in the Win32 security model. At work, we have an application that wants to do the right thing … Continue reading

Posted in Win32 | Tagged , | 17 Comments

The Placement New Operator

I’d like to shed a little bit of light on a dusty corner of the C++ language: there’s more than one “new” operator! Well, since you’ve likely encountered the vector new (new[]) operator, I should say there’s more than two … Continue reading

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

The comma

As C and C++ programmers, we’ve probably seen and used the comma countless times in our applications, without thinking too much about it. However, there are some very interesting points to this piece of punctuation that are worth discussing. The … Continue reading

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

The Joys of Bit Fields

In C and C++, bit fields are one of the more odd declaration types that you run into rarely. The basic idea behind them is to provide the programmer with a way to define declarations at the bit-level. For instance, … Continue reading

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