| View previous topic :: View next topic |
| Author |
Message |
Dave_lopez Member
Joined: 12 May 2004 Posts: 3 Location: Paris
|
Posted: 15/06/04 08:27 Post subject: [For] A 'For to' which reacts like a 'for downto' |
|
|
Hi everybody,
I got a this extract of code which uses a for:
| Code: | For Cpt:=8 to 128 do
D[CPT] := S.D[CPT]; |
What's happening ?
Answer:
| Quote: | D[121] := S.D[121];
D[120] := S.D[120];
D[119] := S.D[119];
...
D[2] := S.D[2];
D[1] := S.D[1]; |
It is driving me crazy ...
Thanx in advance ... _________________ Destiny exists ... |
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 386 Location: Tehran, Iran
|
Posted: 15/06/04 09:17 Post subject: |
|
|
| The downward for loop is faster than the upward one. Because of that, when direction of the for loop variable doesn't affect the result, the compiler optimizes the code and generates the downward loop. |
|
| Back to top |
|
 |
|