[Issue 5749] argument evaluation order of chained function from right

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 18 13:02:22 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5749


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #1 from Jonathan M Davis <jmdavisProg at gmx.com> 2011-03-18 12:59:08 PDT ---
The order of function arguments is _never_ defined. It's completely
implementation dependent. The compiler is free to re-order them as it wishes.
So, for instance, using a variable and incrementing it separately in the same
expression (or incrementing it two places like you're doing) is definitely a
bad idea. It's always been that way in C and C++, and it's that way in D.

Walter has said that he may make it so that the order _is_ defined, which would
eliminate bugs related to someone doing something like you're trying to do, but
that change has never been made.

Regardless, the behavior is completely expected. Don't rely on the order of
evalution of function arguments.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list