Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Incrementing a Hash Value

by Abigail-II (Bishop)
on Jun 14, 2002 at 11:56 UTC ( [id://174466]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Incrementing a Hash Value
in thread Incrementing a Hash Value

It's undefined. See also http://bit.csc.lsu.edu/tutorial/ten-commandments/c-faq/c-4.html (Perl defines the behaviour of ++ as to "work as in C" - as the perlop manual page will tell you).

Abigail

Replies are listed 'Best First'.
Re: Re: Incrementing a Hash Value
by impossiblerobot (Deacon) on Jun 14, 2002 at 20:36 UTC

    I'm definitely not qualified to argue whether this behavior should be considered 'undefined', but I haven't seen any pointers to documentation that says that it is.

    perlop is written in a language which is a little less than explicit than Perl, but it doesn't say that ++ and -- work exactly as in C.

    In fact, perlop says:
    "++" and "--" work as in C. That is, if placed before a variable, they increment or decrement the variable before returning the value, and if placed after, increment or decrement the variable after returning the value.

    In other words, the auto-increment operator works as in C in the specific way mentioned. (perlop then goes on, in the next paragraph, to explain one way in which the perl implementation differs from C.)


    Impossible Robot

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found