Category Archives: Framework Design

Binary Operator Overloading

In C++, there are two forms of binary operator overloading you can use when designing an API. The first form is to overload the operator as a member function of the class, and the second form is to overload the … Continue reading

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

Memory Management in Frameworks

As a framework designer, you have a lot of things to worry about. Calling conventions, size compatibility, structure layout, etc. I’d like to briefly talk about another thing to worry about: memory management. I’m not just talking about “please don’t … Continue reading

Posted in Framework Design | Tagged | 1 Comment

Be Carefully Consistent With Memory

One of the things that most C/C++ programmers start to take for granted is memory. It’s always there, and when used properly, it always “just works.” However, frameworks throw a bit of a monkey wrench into the equation because they … Continue reading

Posted in Framework Design | Tagged , , | 1 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

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

Enumerations for Framework Design

As someone who develops cross-platform and cross-language frameworks, a frequent problem I run up against are enumerations. They’re a very handy construct for a framework designer to use because they allow you to logically group related constants together with some … Continue reading

Posted in Framework Design | Tagged | Leave a comment

The Importance of Calling Conventions

Calling conventions are something you generally don’t have to worry about as a programmer because the compiler usually takes care of everything for you. But when you start interacting with code outside of your control (such as shared libraries), calling … Continue reading

Posted in Framework Design | Tagged , | Leave a comment