Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coding Standards
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00115272
Message ID:
00115393
Views:
17
George,

Well, I had to test it before posting the code fragment, I've stopped assuming things about languages it gets me into too much trouble. *s* I ran into a few places where the MS C/C++ compiler just optimized itself too far. Since VFP is interpretted p-code some optimizations like hoisting invariant code out of loops helps a lot.

DO WHILE does force reevaluation at each iteration because it's just a little different than running a loop counter from a start value to an end value. I think FoxPro has worked like this since 2.5 days which is where I started with it.

>I made an assumption based on my knowledge of the inner workings other languages, where this is (or has been) the case (namely, that the function or expression is evaluated each time through). In fact, whatever occurs to the terminating value within the loop has no effect. In other words you can change the value of the terminator via an assignment and without impacting the number of iterations. Apparently (I checked) this has been the case ever since at least 2.5. It also explains, in part why FOR...ENDFOR loops are faster than DO WHILE...ENDDO.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform