"++" vs "+=" on function parameter
claptrap
clap at trap.com
Sun Mar 8 10:26:54 UTC 2026
On Sunday, 8 March 2026 at 10:16:56 UTC, user1234 wrote:
> On Sunday, 8 March 2026 at 03:30:55 UTC, claptrap wrote:
>> [...]
>> Just seems like p++ should behave like p+=N for parameters, I
>> mean if you had never seen that syntax before you would
>> probably assume similar behaviour.
>
> 1. This would break code
agreed
> 2. that would be inconsistent with the C version
agreed
> 3. that would be globally inconsistent with the definition,
> that can be reduced to "return the value of the sub-expression
> before the side-effect".
Doesnt that mean "p++" is inconsistent? Arn't "p++" and "p+=1"
essentially shorthand for "p=p+1"
More information about the Digitalmars-d
mailing list