Category Archives: C/C++

Varargs? More like Arghargs!

This was a silly mistake on my part, but one which took me several hours to track down. In retrospect, I had everything at my disposal to tell me exactly what the problem was, I just didn’t notice it. It … Continue reading

Posted in C/C++ | Leave a comment

Worst Compiler Abuse Ever

I am pretty sure this qualifies as the worst abuse of a compiler I can think of. Note, I am not recommending you use this in production code, lest you wish to be set on fire by those who have … Continue reading

Posted in C/C++ | Leave a comment

I Learned Something New About New

In my last post, I had mentioned that I found a phenomenon that made no sense to me. It had to do with initializing the members of a structure when calling new. Since I can’t let sleeping dogs lie, I … Continue reading

Posted in C/C++ | Tagged , , , | 1 Comment

Tail Calls

A tail call is a specific pattern of source code where the last instruction executed in a method is another function call. For instance: In this code, the call to last is considered a tail call because there are no … Continue reading

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

Whining about iterators

In the STL, there are multiple classes of iterators: random access, bidirectional, forward, input, and output. I’d like to discuss the different types of iterators in a bit more detail, so that I can whine about “missing” functionality.

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

Stupid Compiler Tricks

A coworker approached me today with an interesting problem and I figured I’d talk about the crazy acrobatics that solved it. He wanted to fill out a list of operations to perform that could be registered easily “at compile time”, … Continue reading

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

The Amazing Visitor Pattern

I’m a big proponent of using design patterns whenever they are the proper tool for the job. One of the design patterns I find myself pulling out of the toolbox fairly frequently these days is the visitor design pattern. However, … Continue reading

Posted in C/C++ | Tagged , | 1 Comment

A simple introduction to type traits

Type traits are a slightly more advanced topic in C++ because it they are heavily used in template metaprogramming. However, it is not an impenetrable concept, and it comes with some great benefits if you like to write generic, reusable … Continue reading

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

An Almost Useful Language Extension

While fiddling around a bit with clang, I came across an interesting C++ language extension from Microsoft. If you’ve done library development on Windows, you’ve likely come across the __declspec keyword for things like importing and exporting symbols from a … Continue reading

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

Destructors

Destructors are one of those inescapable concepts in C++. We’ve all used them, many times without even really thinking about it. But how do destructors work? What can and can’t you do with destructors? There’s a lot more complexity to … Continue reading

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