|
From: Robert W. <rj...@du...> - 2006-01-20 00:43:15
|
On Thu, 2006-01-19 at 16:17 -0800, Uttam Pawar wrote:
> Hi All,
>
> I've a patch ready to submit which has few cleanup changes. If you look at the patch, the code in
> if (verboze) condition is a dead code as verboze is initialized 'False'. I can understand that, the
> code in the condition is some kind of debug output which might be necessary from time to time to
> print the intermediate debug output. So my proposal is to make this output available with -D compiler
> option. So if somebody wants to enable the extra output he/she can make debug build (which has some
> extra option with -D) instead of changing the code everytime he/she wants to enable/disable this
> output. Going further we can use this flag in other places in the code to plant some intermediate
> checkpoints,
>
> I would appreciate any thoughts/comments.
This behavior is intentional. Code like this:
if(verbose)
do_verbose_stuff();
will be syntax-checked/type-checked/etc. by the compiler. It won't be
an optimization problem, as the compiler will notice that the code is
dead and completely optimized out.
However, this code:
#ifdef VERBOSE
do_verbose_stuff();
#endif
will not be syntax-checked/type-checked/etc. by the compiler unless
VERBOSE is true. This means verbose code will bitrot when changes
happen (variables go away, change names, etc.) as most people won't
remember or care about compiling with VERBOSE defined.
Regards,
Robert.
|