Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to declare constants
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00654311
Message ID:
00654312
Views:
18
By definition constant are constant :-)
so #DEFINE is the way to go since the constant was replace by the value at compile time.

If you use a new constant in your code, you have to compile your new code anyway.

Constant defined for one exe or dll are not affected by the same constant in another exe or dll since the constant was already replaced by its value in the compiled code.

The property can be modified at run time and are not the same beast...

>Hi All!
>
>What would be the best way to declare constants in an application wherein it will be available and used throughout the application's activities? Would declaring it as such in a main prg:
>
>
#DEFINE MY_CONSTANT = SomeValueHere
>
>be fine, or creating properties in the main form:
>
>
THISFORM.MyConstant = SomeValueHere
>
>be much better? The latter part I am hesitant to follow since I am thinking about the application's scalability once I need to add more constants in the application. I don't want to compile again an EXE (if I followed creating properties in a form for constants) when I decide to add more constants for my app. My main methods and procedures are stored in a DLL which I call through CREATEOBJECT() so if ever I do decide to add more constants for use in my app, eventually the other thing I need to update and compile will just be my DLL. An INCLUDE file also comes to mind but I'd like to know which is really better for what I plan to do. Thanks in advanced.
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform