Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Auto Increment "magic" Inquiry

by roboticus (Chancellor)
on Jan 04, 2007 at 22:22 UTC ( [id://593037]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Auto Increment "magic" Inquiry
in thread Auto Increment "magic" Inquiry

brusimm:

It's consistent because Perl will generate the code the same way each time you compile it. However, another version of Perl may generate slightly different code for the same sequence.

For example, suppose you have the statement $j = $i++ + $i++;. It's perfectly acceptable for perl to implement it as:

$temp_1 = $i; $temp_2 = $i; $j = $temp_1 + $temp_2; $i = $i + 1; $i = $i + 1;
and it's also acceptable for it to implement it like:

$temp_1 = $i; $i = $i + 1; $temp_2 = $i; $i = $i + 1; $j = $temp_1 + $temp_2;
(Other implementations are also possible...) So while any particular perl compiler will be consistent from run to run, and program to program, different perl compilers (version, platform, vendor, etc.) are free to do it another way.

Your co-worker appears to know which way it's implemented on your perl compiler.

roboticus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://593037]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-19 11:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found