Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constants and SYS(5) + SYS(2003)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00267724
Message ID:
00268043
Vues:
27
>I think were hoping that the constant will be replaced with the SYS functions but not evaluate the sys functions. Tests seem to bare that out. Though it would be nice to be able to look at those constants in the debugger and verify that.

Hi Dan,

Well, I did something unthinkable...I RTFM< g >. While the documentation states that creation of the constant occurs at compile time, I think that something else it says probably applies. "Important Do not use system variables for eExpression. System variables are not evaluated until run time." I have a feeling that creating a constant using native functions causes the interpreter to execute whatever code is associated with the constant at run-time. To test this, I created the following little program
* Test.h
#DEFINE DEFAULT_PATH SYS(5) + SYS(2003)
* Main progam.
#INCLUDE TEST.H
_SCREEN.Visible = .F.
LOCAL lcmsg
SET PATH TO
lcmsg = "Current path is " + DEFAULT_PATH
= MESSAGEBOX(lcmsg)
SET DEFAULT TO C:\FOX
lcmsg = "Current path is " + DEFAULT_PATH
= MESSAGEBOX(lcmsg)
The first message box displayed the exe's startup directory. The second displayed C:\FOX. From these results, I'd say my conclusion is correct.

As far as getting the debugger to recognize compile time constants, I can see the benefit, but I never really worry about what the underlying value is. One of the things that compile time constants are supposed to do is abstract more complex values so that we don't have to worry about the actual value, just the name. In my mind they're somewhat akin to assembly language mnemonics. Just my take, of course.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform