|
|
|
|
|
by KirinDave
3220 days ago
|
|
Indexed loops are just a bad problem waiting to happen. They introduce arithmetic bugs, are the least efficient way to traverse most any data structure but a sequential memory segment, maximize the opportunity for error, and are often harder for compile-time optimizers to work through (since it's harder to prove what they do in situ). Abstracting away your iteration is important. |
|
There is on rare occasion, however, sometimes a problem that is solved more clearly or handily using indexing, similar to step indexing in BASIC.
One use case where I've seen stepped indexing useful is in the field of robotics, which uses step characteristics for synchros and servos.