three18ti has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
I recently inherited a code base that has some... interesting constructs.
For instance this one:
if ($var || 2) { # do stuff here } else { # won't do stuff }
Now, I know that the else will never execute because the conditional is always true. But what does the compiler do? I would think it would Optimize away the else, would it even optimize away the if? How can I see what is happening? O=Deparse only deparses and doesn't actually compile the code, right?
Thanks for the assistance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Compiler Optimization
by BrowserUk (Patriarch) on Feb 24, 2015 at 19:41 UTC | |
by syphilis (Archbishop) on Feb 25, 2015 at 00:22 UTC | |
by BrowserUk (Patriarch) on Feb 25, 2015 at 01:49 UTC | |
by syphilis (Archbishop) on Feb 25, 2015 at 02:29 UTC | |
by BrowserUk (Patriarch) on Feb 25, 2015 at 02:42 UTC | |
by LanX (Saint) on Feb 25, 2015 at 02:17 UTC | |
|
Re: Compiler Optimization
by Anonymous Monk on Feb 24, 2015 at 19:49 UTC |