Field assignments are reordered in record creations
orbitz@REDACTED
orbitz@REDACTED
Wed May 24 17:14:48 CEST 2006
So what is ,? Can I not depend on an expression prior to a , being
evaluated before something after the ,?
What about ; in guard statements?
Is it the same idea, simply not called a sequence point? Or is the
idea not existent?
On May 24, 2006, at 9:59 AM, David Hopwood wrote:
> David Hopwood wrote:
>> orbitz@REDACTED wrote:
>>
>>> I don't believe what is happen is what you think is happening. The
>>> issue is that the order of execution in a single sequence point
>>> is not
>>> defined. Your code does no say anything about which record
>>> fields gets
>>> assigned first, simply which function gets executed first. You
>>> cannot
>>> depend on the order of execution of an expression to reflect how
>>> you
>>> wrote it. Compilers are generally free to execute expressions in
>>> whatever order is easiest for them.
>>
>> Erlang is not C; it has no concept of sequence points. However,
>> you're
>> correct that the evaluation order of arguments to an operator or
>> function
>> call is undefined. See section 6.3 of
>> <http://www.it.uu.se/research/group/hipe/cerl/doc/
>> core_erlang-1.0.3.pdf>.
>
> Sorry, that's Core Erlang. The corresponding statement in the Erlang
> reference manual is in section 6.5 of <http://citeseer.ist.psu.edu/
> 513634.html>.
>
> --
> David Hopwood <david.nospam.hopwood@REDACTED>
>
>
More information about the erlang-questions
mailing list