Field assignments are reordered in record creations

David Hopwood david.nospam.hopwood@REDACTED
Wed May 24 15:59:46 CEST 2006


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