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:
00269941
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...

Hi Bruce,

Let me put in my .02 (US) here.

Defined constants are like anything else in programming. Used correctly they can be extremely important in the areas of readability, reduction of overall application size, and performance. Used incorrectly (abused, if you ask me), they can make maintenance a nightmare.

As far as I'm concerned, in most cases, if you're worrying about the underlying value of the constant or need to know it, it's a strong hint that it's being mis-used. So my rule of thumb in this regard is to use it in those cases where you really don't care as much about the meaning as you do what it represents. Take the MESSAGEBOX() constants, I don't particularly care about what the underlying values are, but I do care about their meaning. Simple illustration would be seeing a return shown as MB_IDYES or 6 (and I had to look it up)?:-)
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