Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro Substition Idea
Message
De
23/02/2006 22:30:09
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01098713
Message ID:
01098763
Vues:
13
I wouldn't use the #DEFINE because I would only use macro sub or eval() if the table name were truely a variable or unknown at design time. I wouldn't just do it for the sake of making the code unreadable. With that in mind, the #DEFINE would never serve my purposes because if I knew what the table name were going to be while I was writing the code I would just use tablename.fieldname w/o assigning the tablename to a variable.

>I have often heard that macro substition is not a good idea.
>
>Instead of using:
>
>
>SELECT 0
>USE BSpotDt
>
>cAlias = "BSpotDt"
>dAirDate1 = &cAlias..AirDate
>
>? dAirDate1
>
>
>Why not do:
>
>
>
>#DEFINE FLD_AIRDATE BSpotDt.AirDate
>
>SELECT 0
>USE d:\projects\testdata\smts\bspotdt
>
>dAirDate2 = FLD_AIRDATE
>
>? dAirDate2
>
>
>Then the expression is compiled in, versus evaulated at runtime. If/when your structure
>changed, it would be no more work to change it then with the macro version. Maybe even
>less work because there is only one play you really have to change - the .h file.
>
>Any thoughts?
Paul A. Busbey
Victoria Insurance
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform