Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Foxpro Life
Message
 
À
15/04/2017 13:08:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrats & ententes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Novell 6.x
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01649781
Message ID:
01650229
Vues:
40
>> The risk is in naming variables that may conflict with field names, and your program processing the wrong values. Do
>
>That never happened to me. Just lucky I guess.
>Now I'm curious.
>Is it a risk in this case?
>
>name = "joe"
>If name = customer.name
>   exit    
>endif
>
Yes, I think the risk is real in your example, where the interpreter has to resolve the ambiguity presented by a field and a var identified with the same token. If the current open table/cursor alias has a field name then the IF line will evaluate that field, not your memvar. So, in your case if the alias of the table open in the current area is customer then the program will execute exit, ignoring the value of the name memvar.
Conflicts may not occur as easily as shown in your example because of programmers' common sense in naming fields and variables. It is useful up to a certain degree of complexity, after which it becomes folklore.
*
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform