On Tue, Aug 07, 2001 at 03:00:52PM +0200, Bart Lateur <[EMAIL PROTECTED]> wrote:
> that the if-block is supposed to be stripped from the compiled program,
> as if DEBUG was replaced with a literal 0? Is the compiler so smart that
> it recognizes a sub that returns a constant? It'd almost have to be that

Yes, if a sub has a () prototype AND is constant (contains only a constant
in the body) and is known at compile-time it will hardcode the constant.
(should make the code smaller as well).

(perl-5.5 (or 5.6?) has introduced newCONSTSUB so you can create these
special subs from xs modules as well).

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       [EMAIL PROTECTED]      |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |

Reply via email to