lmdebug
-------

This library provides a set of typical debugging functions and macros
for aiding development.

Compilation Checks
-----------------

The compilation checks act as sanity checks during the compilation
process.  These will always be enabled and checked during all builds
and have no runtime effect on performance.

expr is any expression which can be evaluated by the preprocessor that
resolves to 0 or not zero.

msg is a quoted string that is printed when expr is true. 

LM_CWARN(expr,msg) -> warn when expr is true
Produces the string #warn msg (##expr) to produce a preprocessor
warning if expr is true.  

LM_CASSERT(expr, msg) -> error when expr is false
LM_CERROR(expr, msg) -> error when expr is true
Produces the string #error msg (##expr) to produce a preprocessor
warning if expr is true.

eg.

/* Check the size of integers on this architecture */
LM_CWARN(sizeof(int) != 4, "this program has only been tested on 32 bit architectures");


Run Time Checks
---------------

These checks are done at runtime to provide sanity checking.

Compiling in any other build type other than _LMDEBUG will cause these
checks to not be compiled to the build.  They will have a size and
performance hit when enabled.

LM_ASSERT(expr) -> call _lm_assert when expr is false

General purpose assert, which will call _lm_assert with expr, source
file and line number if expr is false.  _lm_assert will then print the
assertion string and terminate the program.

LM_WARN(expr) -> call _lm_warn when expr is true

Warning which will call _lm_warn with expr, source file and line
number if expr is true.  _lm_warn will then print expr and ask the user if
they would like to continue or terminate the program.

LM_INFORM(expr) -> call _lm_inform when expr is true

Watch type check which will print expr, source file and line number
without terminating the program.

LM_NULLPTR(var) -> call _lm_assert when var == NULL

Assertion type check which takes a pointer variable and checks if it
is null.  This is useful before referencing local pointer variables to
see if they have been initalized.

DO NOT USE THIS TO CHECK RETURN VALUES FOR DYNAMICALLY ALLOCATED
MEMORY since the check will be compiled out in release mode, which is
not what we want for that type of situation.    

LM_BREAK -> call _lm_break

Used to stop program execution at any point with no message.



 


