I recently read an old article by Rob Pike - Systems Software Research is Irrelevant. It is an excellent flame (which is what it is meant to be - obviously a lot of the commenters missed the point completely). It is very short (about a 15 minute read) and well worth your time reading. And the article is written in 2000 and even more relevant today with the world largely getting polarized into two camps (Microsoft and Linux) with a few Unixes sitting around in the sidelines.
Another favourite of mine - Ken Thompson's Reflections on Trusting Trust - a must read for anyone who deals in computing and wants to make any arguments about security. Create a trojan in a compiler (or linker, or assembler, or microcontroller)'s source that no amount of code review will detect.
I don't know why I threw these two articles here. I think (and I may be rationalizing here) I threw in the former because I recently read it and really liked it and the latter because I throw it in with every set of recommended articles.
Maybe I should start an article trove section on my website....
C++ geek trivia:
C++ does not give default values to intrinsic value types such as ints, doubles and bools. For the vast majority of users who don't care about paying the extra instruction cost for default initialization (rather than finding a bug because you forgot to init a value you're using), this can be a nominal pain in the butt.
Your task, if you choose to care, is to create a wrapper around any value type that does exactly this. As an example, instead of writing
class Foo
{
int a;
};
and having an uninitialized value of a, you'd write
class Foo
{
DefaulInit<int> a;
};
and things will be fine and dandy. a will go ahead and get the value of zero when a Foo object is created. Moreover, DefaultInit<int> must behave as an int for all practical purposes. Code that used a should not need to be changed.
More advanced challenge: write a DefaultInit wrapper that you can set the init value for. For example,
DefaultInit<int, 42> a;
would initialize a with 42.
Note that DefaultInit should work fine with another intrinsic type, say char so that you can write:
DefaultInit<char, 'R'> b;
and things are fine and dandy.
Answers coming up soon!