Aurora: C++ Archives

Recently in C++ Category

Stupid C++ tricks

| | Comments (2)

A while ago Charles Nicholson wrote an article about how they handled asserts in their engine. I kind of liked the title "Stupid C++ Tricks" and it triggered this article idea. Then since of course Noel Llopis managed to beat me to it, that after I've given him a hard time about his infrequent posts :) So without dwelling too much on why there are so many books and articles about traps, pitfalls, stupidity and secrets regarding C and C++ here you go; some more stupid tricks, don't try this at home.

Stomping on dialog boxes

| | Comments (1)
Have you seen the default crash dialog in windows? It's a dialog that's pretty much useless for the normal user (I always just click go away when it happens for other applications) but it's very useful for your own applications. For example, you are debugging some arcane crash that only happens deep inside the content pipeline. It can be tedious to make a reproduction case, that's small enough so that you can run it standalone in the debugger.

#include <windows.h>

| | Comments (14)
Windows.h must be the worst engineered header of all times. It's a meta header, designed to include several others and these are usually so bad that I'm wondering if anyone at Microsoft ever learned to program in a larger environment (ironic is it not?).
I'm going to do something different today, instead of bashing on C++ as I usually do, I'm going to point at some good things about it. In fact, it's even involving templates, my old archenemy (Bowser is nothing compared to them). So while I'm happily downloading The Orange Box on Steam, I'm writing this very quick and dirty post.

NULL, how I hate you

| | Comments (7)

Every now and then a discussion about NULL comes up. Much like operator overloading of multiplication of a geometric vector class. In the course of the discussion many questions and theories are covered, I'd like to give my views on them here in this short article.

In one of the murky corners of C++ we find all the rules for static initialization hidden. They hide here because they are hideous, deformed and frightening. If they were out in the open, noone in their right mind would start down the path of actually learning and using C++. Or so I would think. Anyways, if you're with me in the boat of "we're already screwed and we have to use C++" then read on and we'll try to put some pretty clothes on the monsters instead.

I thought I would ramble on a little about the class constructor in C++ as well as start a new topic in the blog, C++. Here is the first installment. A little random, but fun facts. Keep your copy of the standard close by.

Namespaces, lookup and ADL

| | Comments (0)

C++ has a lot of nasty corners that smell a lot as well as some remarkable things that can be used in some fairly suprising manners. One of the little understood corners of C++ is name lookup. Name lookup is something very basic but the basics seems to be the things that people skim over when learning C++ or just using it. Things like L-values and R-values are part of the basics and they are sadly little understood.

One of many wierd constructs in C++ is the ellipsis construct (...). That's a way to specify that there might come a variable amount of extra parameters after the one that you give. Underneath there is no real magic, the parameters that you specify are pushed onto the stack and then inside the function you can traverse the stack. There are some catches with this though. In this little article we'll explore how the ... works and what not to do.