Increment / Decrement Operator Behavior

Mikael Lindsten mikael at lindsten.net
Tue Jun 5 01:23:18 PDT 2012


2012/6/5 Jonathan M Davis <jmdavisProg at gmx.com>
>
>
> I think that Bernard is being a bit harsh, but in essence, I agree. Since
> the
> evaluation order of arguments is undefined, programmers should be aware of
> that
> and code accordingly. If they don't bother to learn, then they're going to
> get
> bitten, and that's life.
>
> Now, Walter _has_ expressed interest in changing it so that the order of
> evaluation for function arguments is fully defined as being left-to-right,
> which solves the issue. I'd still council against getting into the habit of
> writing code which relies on the order of evaluation for the arguments to a
> function, since it's so common for other languages not to define it (so
> that
> the compiler can better optimize the calls), and so getting into the habit
> of
> writing code which _does_ depend on the order of evalution for function
> arguments will cause you to write bad code you when you work in most other
> programming languages.
>
> As for treating pre or post-increment operators specially in some manner,
> that
> doesn't make sense. The problem is far more general than that. If we're
> going
> to change anything, it would be to make it so that the language itself
> defines
> the order of evaluation of function arguments as being left-to-right.
>
> - Jonathan M Davis
>

Agree completely!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120605/633f7d20/attachment.html>


More information about the Digitalmars-d mailing list