I believe at one point in the murky past of C++ one of the intel compilers actually had a problem where i++ was less efficient than i=i+1 due to some pipelining issue, but rumour at the time had it that this was only a problem on intel chips!
S
Suzetta
@Suzetta
Posts
-
Fun with Operators -
Obvious and stupid :-)It is indeed - but I think it should be obvious if you know your basic number representations. Testing for equality is similar, in that you run out of precision, but I guess my version is less intuitive as you 'expect' to be able to add one and get a result that is bigger than the original value :-)
-
Obvious and stupid :-)Some time back, I was perplexed as to why my program went into an endless loop. This was in VB, but of course is language independant when you look at it. Obvious, dumb, but still not something many programmers (even experienced ones) think of for some reason: for (Single i = 1000001; i < 20000000; i++) { // do stuff... }