Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I wish this was in VFP and not VB.....
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00519713
Message ID:
00520961
Views:
36
>George,
>I just entered your example into a prg.
#DEFINE DEFAULT_DIR SYS(5) + SYS(2003)
>CLEAR
>? DEFAULT_DIR
>? SYS(5) + SYS(2003)
As expected, both lines return the same value - i.e. they are both evaluated at run-time not compile-time. I re-assert that the pre-processor in the VFP compiler does not evaluate anything at compile-time. All that is happening is the strings are swapped by the compiler before tokenization!

Houston,

I think that this is a mis-understanding on my part. I thought that you were saying that the return values functions were being evaluated at compile time, not run time. As I said to Erik, what's actually happening is that any function references are actually inserted into the tokenized code when compilation takes place. Therefore, and perhaps a better example of this, the following code returns two different values, provided a different default is selected
#DEFINE DEFAULT_DIR SYS(5) + SYS(2003)
? DEFAULT_DIR
SET DEFAULT TO (GETDIR())
? DEFAULT_DIR
This can be simply entered and executed into a program file.

This behavior, however, does not match that of some other compilers where a reference to the constant is inserted, rather than the actual literal.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform