Warn about do nothing expressions?

Timon Gehr timon.gehr at gmx.ch
Sat Mar 29 09:40:31 PDT 2014


On 03/29/2014 05:31 PM, Frustrated wrote:
> .. i++, even in an assignment, increments i.
> ...

TDPL specifies the behaviour of i++ as follows:

{auto tmp=i; ++i; return tmp;}();

> i = j++;
> ...

i = {auto tmp=i; ++j; return tmp;}();

> even if i is assigned the previous value of j, j STILL gets incremented
> by one.
>
> Change i to j and it will work out.
> ...

i = {auto tmp=i; ++i; return tmp;}();



More information about the Digitalmars-d mailing list