Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lost programs, undeclared arrays, reports, and misc. q's
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00087807
Message ID:
00089057
Vues:
37
>>Just a comment here. I've never found VFP to be "forgetful". Whenever something like that happens, it's always been the programmer (me :-)).
>
>Well, then what does it mean when you're running the same code on the same operating system, on two different computers? On one computer it uses the index and prints in the proper order. On the other computer it says "unknown variable indexname" (or something like that. I thought it was a Win32s problem. It's not. The client has upgraded and it's still happening.
>
Yep, I've seen it and had it happen to me. But the reason was that the command:

SET ORDER TO SOMETAG

didn't generate the error it should have. The error should be "Index tag does not exist". However, you'll the "unknown variable" with compound index files if the tag doesn't exist. In each case, I forgot to create it. It was me, not FoxPro. :-)


>>VFP (and all xBase languages) are very loosely typed. IMHO, it's a bad practice, but perfectly legal to change types on the fly. Unlike good old BASIC, which uses a suffix character for many types, there's nothing like it VFP. That's one reason why some use what's referred to as Hungarian notation to define what type of variable is being manipulated. I've never seen VFP (or any other language, for that matter) change a data type for you. Look over your code, you may find something like the following, which will cause a data type mismatch.
>>
LOCAL lnvalue
>>lnvalue = lnvalue + 1
>>The above declares the variable, but never assigns a type to it (eg. lnvalue = 0), by default it's a logical until it's assigned.
>>
>
>I can't remember exactly what happened, now, but I know I declared the variable as public, then when I tried to put a date in it it gave a type mismatch. I think it was like "somedate = table.date". It didn't like that. But if I do "somedate={ / / }" right after I declare it, then it can handle putting the date in it.

Initializing variables immediately after you declare their scope is good programming technique.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform