Post increment and decrement

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 14 15:23:44 PDT 2015


On Saturday, 14 March 2015 at 10:11:27 UTC, Casper Færgemand 
wrote:
> What exactly is the downside of i++? Suppose the compiler 
> doesn't lower it and I use the expression alone, what is the 
> potential damage?

You need to store a temporary of the value pre increment to be 
returned. But it doesn't matter as any compiler will optimize it 
away if you don't use it.

But, for some reason, the topic come up again and again from C++ 
devs that have no idea the optimization guys solved the issues 
for years now.


More information about the Digitalmars-d mailing list