Post increment and decrement

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 21 14:51:59 PDT 2015


On 3/21/15 9:59 AM, welkam wrote:
> On Saturday, 21 March 2015 at 00:42:22 UTC, Andrei Alexandrescu wrote:
>>
>> Are you sure you're not missing the part where D's ++var and var++
>> generate identical code if the result isn't taken? -- Andrei
>
> No I am not missing it. I think I need to explain why I am doing all of
> this.
>
> I am currently looking for rules and programming styles that would
> reduce number of bugs and/or make my program run or at least compile
> faster. So I read that you should prefer pre increment to post
> increment.

That's only for generic C++ code. At a minimum you're in the wrong 
forum. Also as I said, using post operations for integrals may be 
faster, so even in C++ it's not that clear cut.

Andrei



More information about the Digitalmars-d mailing list