diff code_part1/OSTC_code_c_part2/p2_definitions.h @ 235:ade0848c8b8b

New runtime asserts when compiled in DEBUG more. When __DEBUG is defined, the assert() calls are checked, and PLED_resetdebugger is called when the condition fails.
author JeanDo
date Sat, 19 Mar 2011 11:34:32 +0100
parents 638f8e17bd51
children a99073445c18
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_definitions.h	Thu Mar 17 18:32:16 2011 +0100
+++ b/code_part1/OSTC_code_c_part2/p2_definitions.h	Sat Mar 19 11:34:32 2011 +0100
@@ -112,7 +112,11 @@
 #   pragma warning(disable: 4244 4068 4305)
 #else
 #   define PARAMETER static
-#   define assert(predicate)
+#   ifdef __DEBUG
+#       define assert(predicate) if( !(predicate) ) assert_failed(__LINE__)
+#   else
+#       define assert(predicate)
+#   endif
 #endif
 
 //////////////////////////////////////////////////////////////////////////////