Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best approach about #DEFINE constants
Message
From
14/05/2008 20:14:55
 
 
To
14/05/2008 09:26:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01316940
Message ID:
01317191
Views:
16
>Hi.
>I'm using VFP9 SP2.
>I have some constants that I tried to declare
>using #DEFINE. These constants must be used
>throughout my application (forms and procedures).
>The problem with #DEFINE is that the constants are
>only visible within the program that created them.
>How to make some constants, lets say, "PUBLIC"?
>Thanks!

"PUBLIC" as such wouldn't be the best solution, if it existed, since the existence of those constants wouldn't be clear in the application. At the same time, having to code the entire group of constants individually is somewhat counterproductive, too.

I'm a big believer in using #INCLUDE files that hold logically grouped #DEFINE constants. This especially goes when one has a set of constants that accompany a given class library - one would include someclass.vcx and someclass.h at the same time in the project and be sure to put an "#INCLUDE someclass.h" statement at the beginning of any module that used someclass.vcx. And foxpro.h shows up in almost every module I write.

Hope that helps,

David
David M. Stowell
Ravenslake Consulting
Chicago, Illinois

e-mail: davidstowell@ravenslakeconsulting.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform