Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass Local Array Variable, Unexpected Results
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00894043
Message ID:
00894219
Views:
9
>You're right about this occurring in VFP 7.0, but not it 8. I was able to workaround the problem by placing the LOCAL reference to lnX on a separate line. Apparently, when used with data type declarations in 7.0, the LOCAL keyword is ignored and the variable becomes private. This short circiuts the loop counter. Alternate workaround would be to use different variable names, but that becomes a real PITA.


I did some more testing, and I think that I found the problem. VFP 7 does not process any variables in LOCAL statement after an ARRAY that is strong typed. For example, in the following command...

LOCAL lnBef AS INTEGER, lcBef AS CHARACTER, laOne(1) AS CHARACTER, lnAft AS INTEGER, lcAft AS CHARACTER

...only the lnBef, lcBef, and laOne variables are created. The lnAft and lcAft are not created until the first time they are used, and thus are created as privates. If I remove the AS clause for the array, everything is ok. Lesson learned, do not strong type array's in VFP 7.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform