Field assignments are reordered in record creations

David Hopwood <>
Wed May 24 15:59:46 CEST 2006

David Hopwood wrote:
>  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
> <>.

Sorry, that's Core Erlang. The corresponding statement in the Erlang
reference manual is in section 6.5 of <>.

David Hopwood <>

More information about the erlang-questions mailing list