Hi KDJ
I remember, when I tried to create some
documentation for this function, I had
also examined the sources (and I did it again now).
My impression is the code is a little "quick and (if not dirty) incomplete".
- it is error prone, since it has no error detection (neither during compile-time nor run-time),
- it returns inconsistent value and , as you correctly saying,
- "performs only half of what traditional loop..."
I cannot guess the intention of the developer who created the function but I can imagine an excuse:
this function mimics the
`for(...)` loop of C-language and mimics it very well, in the sense,
that just like in C, the programmer is equally responsible and free either to create good,
bug-free code or to "shoot his foot!"
Besides, the open source code is open not only for use but also
open to improvements!
Certainly, the code you suggest is in this direction and, if you wish, please integrate it
in the initial function and post the final result.
regards,
Pete