Front page | perl.fwp |
Postings from August 2001
Re: Sorting in-place
Thread Previous
|
Thread Next
From:
Ronald J Kimball
Date:
August 7, 2001 06:05
Subject:
Re: Sorting in-place
Message ID:
20010807090518.A601120@linguist.thayer.dartmouth.edu
On Tue, Aug 07, 2001 at 03:00:52PM +0200, Bart Lateur wrote:
> BTW can anybody explain how the "magic" works? I mean: how comes that in
>
> use constant DEBUG => 0;
> if(DEBUG) {
> .... # things to do when debugging)
> }
>
> 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
> way.
Yes. A subroutine that has an empty prototype and that simply returns a
constant value is inlined by the compiler.
Ronald
Thread Previous
|
Thread Next