Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
#DEFINE - Why?
Message
 
À
30/03/2008 19:48:52
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01306848
Message ID:
01307029
Vues:
10
>What is the simplest explanation as to why these are needed? Why not just set regular variable values? So what if they are constant and don't change?
Jay,

#DEFINE is a compiler dircetive. It is NOT a variable. They are evaluated at compile time and are used as a sort of search and replace on the source code of the file that has the #DEFINE in it to replace all occurances of the defined string with the defined value., so ...
#DEFINE MyString 123

lnVar = MyString
ends up compliine as ...
lnVar = 123
These replacements occur at COMPILE time and not at run time. Using them for constants reduces the number of memvars you are carrying around in your runtime code.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform