Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
#DEFINE - Why?
Message
De
31/03/2008 16:58:30
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
31/03/2008 16:55:54
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:
01307147
Vues:
11
That seems to be the biggest difference. Readability. Of course the choice is mine, I'm just not seeing the big advantage. It's just another way to do something, which is one of the things Foxpro does very well. Gives you choices.

>I work on many different applications. I have a standard .H file where several of these reused constants are defined. As with the FoxPro.H file, I include the standard in the application once. Not only does it contains character to Constant definition, but also our company info, a few other constants that are used everywhere.
>
>I uses constants to ease the readability and lessen the time to type the code. But the chose its yours.
>
>>Um...
>>
>>m.Constant_CRLF = CHR(13)+CHR(10)
>>
>>or
>>
>>oProject.Constants.Constant_CRLF = CHR(13)+CHR(10)
>>
>>I think that works too.
>>
>>>>Isn't that more of an issue of coding practices rather than using a variable vs defines? I can do the same thing you just said with variables.
>>>
>>>Besides, do like type CHR(13)+CHR(10) all over the place, or would it be easier to type CRLF.
>>>
>>>#DEFINE CRLF CHR(13)+CHR(10)
>>>
>>>>
>>>>>Then look at this from a maintenance viewpoint. Values that appear in code are called, "magic numbers". They do something, but you don't necessarily know what they mean. It's just a number. And, it may appear in several places, which means if the value changes at some point, you have to hunt them all down. If you use a #DEFINE, you can give the number some meaningful name. And, if all the #DEFINEs are in a single file, you only have to go one place to change them.
>>>>>
>>>>>Run down to your local Borders bookstore and find the book "Code Complete" by Steve McConnell and read about magic numbers.
>>>>>
>>>>>
>>>>>>Is this an issue really?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform