Have comments related to the Mobile office article?
Please post them here ;)
Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts
Thursday, October 11, 2007
Boost Logging v2 - with documentation
I've added quite a bit more cool things to the lib, and added documentation.
http://torjo.com/log2/
http://torjo.com/log2/doc/html/
Enjoy ;)
http://torjo.com/log2/
http://torjo.com/log2/doc/html/
Enjoy ;)
Wednesday, October 3, 2007
Boost Logging v2
Well, it's been a looooong time... But I'm back!
I'm developing the Boost Logging Lib v2 - Check it out!
Feedback is most welcome!
I'm developing the Boost Logging Lib v2 - Check it out!
Feedback is most welcome!
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);
#else
void myfunc(my_args);
#endif
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:
#include
#ifdef CUSTOM_ASSERT
// 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);
#endif
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:
#ifdef _DEBUG
void myfunc(my_args);
#else
void myfunc(my_args);
#endif
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:
#include
#ifdef CUSTOM_ASSERT
// 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);
#endif
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
Subscribe to:
Posts (Atom)
