a = 5+3; is slower than a = 8; because it has an extra addition, right?| There are some compilers that do not do this though |
| If you'd like, go and try that with every compiler and see if it's the same as some will give different results. |
| computerquip wrote: |
|---|
| There are some compilers that do not do this though |
The for statement for ( for-init-statement conditionopt ; expressionopt ) statementis equivalent to
[...] Either or both of the condition and the expression can be omitted. A missing condition makes the implied while clause equivalent to while(true). |
| for(;;); 0041138E jmp main+1Eh (41138Eh) while(true); 00411390 mov eax,1 00411395 test eax,eax 00411397 je main+2Bh (41139Bh) 00411399 jmp main+20h (411390h) do; while(true); 0041139B mov eax,1 004113A0 test eax,eax 004113A2 jne main+2Bh (41139Bh) |
|
|
|
|
foo *= 256 is likely to get compiled to foo <<= 8 if there's a speed difference.| You're much more likely to have speed issues with memory accesses |
| Features * Extreme Performance PC3-16000 (2000MHz) * EPP Ready * Equipped with advance aluminum heat-dispersing shields * 100% Tested and Verified * Lifetime Warranty * RoHS Compliant |