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:
00270026
Vues:
31
>>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)?:-)
>
>Hi George - Let me use Jim's PI example...does it really matter whether you use a local or a #define for the PI value? I've always used locals or properties for such things, but am wondering if it's worth moving to constants.

Bruce,

The #DEFINE will be faster.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform