"++" vs "+=" on function parameter

Sergey kornburn at yandex.ru
Sun Mar 8 12:50:35 UTC 2026


On Sunday, 8 March 2026 at 12:42:19 UTC, Nick Treleaven wrote:
> On Sunday, 8 March 2026 at 10:26:54 UTC, claptrap wrote:
>> Doesnt that mean "p++" is inconsistent? Arn't "p++" and "p+=1" 
>> essentially shorthand for "p=p+1"
>
> From https://dlang.org/spec/expression.html#order-increment:
>
> ```d
> Expression	Equivalent
> ++expr		((expr) += 1)
> expr++		(ref x){auto t = x; ++x; return t;}(expr)
> ```

I'm amazed how we have the whole discussion about obvious thing 
that every high school student who ever learned any C-like 
language knows :)


More information about the Digitalmars-d mailing list