Discussion: Should we put all asserts, outputs and robustness-checks in #ifdef DEBUG ... #endif blocks
Hey everyone,
I was thinking about the complexity of jpscore and all the stuff that is logged, bound-checked and stuff:
Some of that is done because of good defensive programming style, some is done to track the program or to find bugs, etc..
I would like to ask you all, if we want to define one or two macros for conditional compilation (like DEBUG and/or VERBOSE, ASSERT) to but those checks, outputs and stuff in additional compilations and have a raw, fast compilation without all of them, once we verified the correctness of the program.
Example: While programming the ffRouter, I deal with several floor-fields (one for each room). If I query a direction and one of the two arguments (pedestrian, goal) is outside the floor-field, the result will be devastating (most likely a segfault).
So I do check in each query, if both arguments are valid. This will slow down the program. Once I know, the program-logic is correct, I could remove most of the checks - (at least most of the debug-output).
It is a (controversial) technique, to put those parts of a program in conditional blocks (#ifdef KEYWORD
). What do you think about that?