Category Archives: C/C++

Now, With More Tidbits!

Sorry about the distinct lack of content lately, but I’ve been busy putting together a new training initiative for my day job. This initiative involves sending weekly snippets of information on C and C++ to many of our developers. The … Continue reading

Posted in C/C++ | Leave a comment

Theory and Reality

One thing which I am pretty religious about is the placement of ++ and — in an expression. You have two options for where it can go. If it goes before the operand, it’s a pre-increment/decrement. If it goes after … Continue reading

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

Describing the MSVC ABI for Structure Return Types

An ABI is an “application binary interface”, which is basically a contract between pieces of executable code on how to behave. The ABI dictates things like how parameters are passed, where return values go, how to create and destroy stack … Continue reading

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

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 , , | 7 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