Here is my assert macro:
Code:
#ifdef ASSERTIONS
#define assert(condition,message) if(!(condition)) printf("Assertion failed: %s",&message)
#else
#define assert(condition,message) ;
#endif



If you now write #define ASSERTIONS you can use the assert macro as you would use as any other function. If you delete the #define ASSERTIONS command from your main file all assertions in your code will be ignored.

For those who don't know what an assertion is: An assertion is a assumption you do while programming. Let's imaging you had a function that takes an int as a parameter that should never be 0. If you write as the very first instruction in your function assert(MyInt != 0,"Passed 0 to MyFunction"); you will be notified whenever your assumption is proven wrong. Assertions do not influence the runtime speed of your application as you can deactivate them when publishing your game.

Unfortunately the __line__ and __file__ macros are not yet implemented. They would greatly contribute to the assert function.


Always learn from history, to be sure you make the same mistakes again...