Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Constants vs Locals
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00269906
Message ID:
00269991
Views:
26
>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.
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform