Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constants and SYS(5) + SYS(2003)
Message
De
24/09/1999 15:54:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00267724
Message ID:
00268740
Vues:
40
>Hi Albert,
>>>
>>
>>What is confusing? It #defines in foxpro work just like they do in all of the other languages that use them (with the exception of case insensitivity). It is just compile time macro expansion. I would not worry about the behavior changing, it is standard now.
>
>First, AFAIK no other language evaluates a compile time constant at run time. That in and of itself leads to some confusion. Once evaluated at compile time, it is what is says, a constant and cannot be changed. In this case the value can be changed, which, by definition, makes it a variable. Second, one of the benefits of using compile time constants is that the reference to it doesn't have to be evaluated at run time, leading to improved performance. That's not the case here. Anytime a native function call is used in assigning a compile time constant, it is re-revaluated at run time. It doesn't matter if the function always returns the same value (i.e. REPLICATE("A", 5)) or not (i.e. SYS(5) + SYS(2003)). It's re-evaluated.

The behavior that you describe is exactly what I expect, it works just the same as C and C++. C/C++ functions are not evaluated at compiletime either. A #define is just code to be pasted into the source durring the preprocessor phase. Name for me a language that uses #define and evaluates the macro expressions at compiletime. Other development environments may have the ability to evalute expressions at compiletime, but I am not aware of any that uses the #define syntax for this purpose.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform