Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
#DEFINE - Why?
Message
De
31/03/2008 01:42:16
 
 
À
30/03/2008 19:48:52
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01306848
Message ID:
01306864
Vues:
9
>What is the simplest explanation as to why these are needed? Why not just set regular variable values? So what if they are constant and don't change?

Here's one thing they're useful for:

Suppose you have an application you're selling, to multiple registered companies/users and in multiple languages. #DEFINEs let you do this without changing your source code.
#INCLUDE Language.h
#INCLUDE CompanyInfo.h

...

[Language_ENU.h]
#DEFINE SomeCharString "English Message"

[Language_ESP.h]
#DEFINE SomeCharString "Spanish Message"

[Company1Info.h]
#DEFINE CompanyName "Some Company"

[Company2Info.h]
#DEFINE CompanyName "A Different Company"

* To regenerate your application for Company2 in Spanish:
- Overwrite Language.h with Language_ESP.h
- Overwrite CompanyInfo.h with Company2Info.h
- Recompile All, et voila !
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform