lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Thu, Jun 22, 2006 at 10:07:51AM -0300, Roberto Ierusalimschy wrote:
> The point is that you cannot evaluate two arguments "in parallel".
> Harbison & Steele[1] say something similar for ANSI C, but I could not
> find this in the standard. Lua should also respect that restriction. [#10] The order of evaluation of the function designator,
  the actual arguments, and subexpressions within the actual arguments
  is unspecified, but there is a sequence point before the actual

So any side effects from evaluating the arguments will occur in some
unspecified order.  Since there's no implicit sequence points between
the arguments, if the argument expressions don't contain any sequence
points of their own and they try to modify the same object more than
once, you end up with undefined behavior:

  6.5 [#2] Between the previous and next sequence point an object
  shall have its stored value modified at most once by the evaluation
  of an expression.  Furthermore, the prior value shall be accessed
  only to determine the value to be stored.

                                                  -Dave Dodge