Expression evaluation order

Jonathan M Davis jmdavisProg at gmx.com
Thu Jun 13 16:25:27 PDT 2013


On Friday, June 14, 2013 01:09:18 David Nadlinger wrote:
> There is a test in the DMD testsuite that verifies that the
> evaluation order in the following statement
> 
> a()[] = b()[] + c()[];
> 
> is b, c, a.
> 
> I'm trying to figure out why this regressed with the 2.063 merge
> in LDC, but (where) is this specified in the first place?

Walter has expressed a desire in the past to make it so that D requires that 
the evaluation order of arguments be left-to-right in order to avoid bugs, and 
while these aren't exactly function arguments, they're basically function 
arguments to a built-in function called +, so I could definitely see Walter 
wanting to require that the evaluation order be left-to-right. However, while 
Walter has expressed an interest in making it a requirement, AFAIK, it has 
never officially become one and the spec says nothing on the matter.

- Jonathan M Davis


More information about the Digitalmars-d mailing list