Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best approach about #DEFINE constants
Message
De
14/05/2008 20:14:55
 
 
À
14/05/2008 09:26:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01316940
Message ID:
01317191
Vues:
17
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform