Post increment and decrement

welkam via Digitalmars-d digitalmars-d at
Sat Mar 21 09:59:03 PDT 2015

On Saturday, 21 March 2015 at 00:42:22 UTC, Andrei Alexandrescu 
> 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. So I investigate and concluded that 
for the most part it doesn't matter. But that "most if the time" 
thing bugged me over a month. I investigated more and I was 
jumping constantly between it matters and it doesn't matter. 
Every time I jump to it matters the amount of matters shrinks. So 
now I am on the quest to quantify how much it matters and if it 
doesnt matter I could say to anybody who repeats it to eat a bowl 
of dicks.

In C++ world always writing ++var can save some perf when using 
with overloaded operators. In D world it has no result on 
resulting binary and the use of these operators is reduced with 

More information about the Digitalmars-d mailing list