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:
00269994
Views:
21
>>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.
>
>Of course, in that case, I might have a wider-scope property for PI instead, but this is a good example for my question. I use top-levels where props are available everywhere, so I can use
>
>topform.nPI = 3.141695
>
>vs
>
>#DEFINE PI 3.141695
>
>So, here the DEFINE is better, I guess, because of performance, unless I may need to wonder about the value somewhere during debugging?

Say, just out of curiosity, where are you guys getting this value of PI from?
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform