Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I see often on the CB people talking of using
print "whatever" if $DEBUG. The (admittedly small) problem: the debug code is compiled in, even if $DEBUG is later set to 0 in the life-cycle of the program
One may prefer to say: In the compiled code, there is no subroutine call but a constant value. So when DEBUG is defined to be 1, peephole optmization makes the print "whatever" inconditional. When DEBUG is defined to be 0, the whole printing statement is optimized out. See the Camel p 229 for the definition of "Inlining Constant Functions". I am probably not the first coming with this idea. So I would be happy to add credit and pointers. -- stefp In reply to inlined DEBUG constant versus $DEBUG by stefp
|
|