in reply to Re: Pre vs Post Incrementing variables
in thread Pre vs Post Incrementing variables
It's got nothing to do with operand evaluation order. It has to do with pre-increment returning lvalues.
is more or less equivalent tof(++$i, ++$i)
do { local @_; alias $_[0] = ++$i; alias $_[1] = ++$i; &f; }
Since the pre-increment operator returns the variable itself and not a copy, the above is the equivalent to
do { local @_; ++$i; alias $_[0] = $i; ++$i; alias $_[1] = $i; &f; }
As you see, f() sees the same value for both arguments as both arguments are the same variable.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Pre vs Post Incrementing variables
by BrowserUk (Patriarch) on Sep 12, 2010 at 17:41 UTC | |
by repellent (Priest) on Sep 12, 2010 at 20:04 UTC | |
by BrowserUk (Patriarch) on Sep 13, 2010 at 01:26 UTC | |
by BrowserUk (Patriarch) on Sep 13, 2010 at 02:00 UTC | |
by repellent (Priest) on Sep 13, 2010 at 04:20 UTC | |
by BrowserUk (Patriarch) on Sep 13, 2010 at 05:20 UTC | |
| |
by ikegami (Patriarch) on Sep 13, 2010 at 03:16 UTC | |
by BrowserUk (Patriarch) on Sep 13, 2010 at 03:45 UTC | |
by ikegami (Patriarch) on Sep 13, 2010 at 05:42 UTC | |
by BrowserUk (Patriarch) on Sep 13, 2010 at 06:20 UTC | |
| |
by JavaFan (Canon) on Sep 13, 2010 at 08:55 UTC | |
by ikegami (Patriarch) on Sep 13, 2010 at 16:33 UTC |