Recently in C++ Category
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.
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.
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.
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.