Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constants vs Locals
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00269906
Message ID:
00269956
Vues:
17
>Is there any reason to use a #DEFINEd constant instead of a local var? I've seen it done, but am not aware if the rationale, particularly when trying to debug...

Bruce,

Conatants are for values that do not change, variables (of any scope) are for value that do change. For example:

A system for engineers who build bridges.
The value of Pi is required throughout the system.

Your choice is use a local var that is intitialized in each routine to 3.14 or use a #DEFINE in a header fiel to define kPI as 3.14.

The value of Pi appears in 237 routines.

The system is delivered and used. The client comes back and says, "hey, we need to use 3.1417 instead of 3.14". If you used locals you have many changes to make, if you used the ehader #DEFINE you have one change to make.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform