Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why define constants
Message
From
25/10/2006 10:27:23
 
 
To
24/10/2006 20:15:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01164235
Message ID:
01164363
Views:
12
>>Could someone educate me as to why it is standard practice to define constants with a variable name rather than to just use the constant in the code?
>>
>>IE, why is:
>>
>>#define MY_CONSTANT "My constant"
>>? MY_CONSTANT
>>
>>better than
>>
>>? "My constant"
>>
>>
>>I understand that it may make it easier to change the value of the constant if the need arises during design, but if the constant is only used in one place in the application is there still an advantage?
>>
>>Thanks for any enlightenment.
>
>If it's used in one place then there is no need for it.
>But if you are planing big application then it's real advantage since you don't need look up for every place where is used but instead change it in one place and change happens everywhere.

Only after recompile however.
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Reply
Map
View

Click here to load this message in the networking platform