Friday, September 28, 2007

I only read it for the comments...

Just read Why Microsoft must abandon Vista today... - while the article is not that convincing, anyway, it's one of those greeaaat articles, with lots of comments - since everyone is entitled to their opinion, and they want to share it with the rest of us... And what makes it even better - the fact that most people choose sides - the article is either enlightening, or crap. And, under the hood of anonymity, you get to cheer or flame lots of OSs and OS versions...

This reminds me of football (soccer) games - where everybody has an opinion of what each player should do/have done. It's fun fun fun!

We need more of these articles! Yuppie!

Wednesday, September 26, 2007

#ifdef _DEBUG - baaaad directive!

I see a lot of code that uses _DEBUG or NDEBUG to create different versions of functions, variables, etc:

#ifdef _DEBUG
void myfunc(my_args);
void myfunc(my_args);

However, we can always do better - when using #ifdef, specify your intent. The fact that a directive happens to be turned on only in debug mode, that's a different story.

Why? You have more flexibility, being able to turn the directive on/off in both debug and release configurations, or even in other custom configuration you might have.

Case in point:


// even on a failed assertion, we don't break!
#undef assert
#define assert(exp) (void)( (exp) || (custom_assert(#exp, __FILE__, __LINE__), 0) )
void custom_assert(const char *, const char *, unsigned);

The above allows me to create my custom assert function. This will happen only if CUSTOM_ASSERT is turned on.

For my application , I need this:
  • in release, while doing testing
  • in debug mode, while deploying application to the customer

Tuesday, September 25, 2007

Friday, September 21, 2007

The beginning...

I've wanted to create a blog for quite a while now, and "I've just been busy"... And I'm busy now too, but I chose to make time...

It's always good to get in touch with your virtual self... So, that's what I'm doing. I'm making my thoughts go digital. Just in case I need to later do a search on them...