Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: question 1st - undefined behaviour

by rumos2 (Acolyte)
on Sep 23, 2013 at 23:41 UTC ( [id://1055407]=note: print w/replies, xml ) Need Help??


in reply to Re: question 1st - undefined behaviour
in thread question 1st - undefined behaviour

-we post it in close time))
I understand that,
$x=$x + ++$x + $x++ and
$x=++$x + $x++ $x
entirely different, I've just want to understand:
1. does $x++ return an object copy before incrementing it's value?
2. does ++$x return original object, but not value of $x after $x incrementation ?
3. why in first example ($x + ++$x + $x++ ) first $x is used as a copy of $x for the moment when it's not been changed, and in second example (++$x + $x++ + $x) we get not copy of $x but original $x.

And I don't seeking for
Note that just as in C, Perl doesn't define when the variable is incremented or decremented. You just know it will be done sometime before or after the value is returned. This also means that modifying a variable twice in the same statement will lead to undefined behavior. I want to understand, and search for any document or c++-source, which describe what exactly happens here and why.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-26 03:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found