Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Constant
Message
From
02/09/2006 18:01:24
 
 
To
02/09/2006 07:41:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01150492
Message ID:
01150563
Views:
23
>Hi,
>Is constant evaluated only during compile time?
>


it is not an evaluation process, but a simple "string replacement", at compile time only.
you can see it with [] string
#DEFINE   APPFOLDER      "C:\myproject\"
#DEFINE   MYPRGFOLDER    APPFOLDER + "PRGS"

? [MYPRGFOLDER]     && Show "C:\myproject\" + "PRGS"
>At first, I hardcoded my application folder as constant.
>
>
>#DEFINE   APPFOLDER      "C:\myproject\"
>#DEFINE   MYPRGFOLDER    APPFOLDER + "PRGS"
>
>?MYPRGFOLDER     && Show C:\myproject\PRGS
>
>
>Then, I changed my code to allow user to specify app folder during runtime. So I changed code as below.
>
>
>**#DEFINE   APPFOLDER      "C:\myproject\"
>#DEFINE   MYPRGFOLDER    APPFOLDER + "PRGS"
>
>LOCAL APPFOLDER
>
>APPFOLDER = ADDBS(GETDIR())    && User select "C:\MYPROJECT2\"
>?MYPRGFOLDER     && It shows C:\myproject2\PRGS too!!!!
>
>
>I was thinking constant only been evaluated during compile time.
>
>Please advice.
Previous
Reply
Map
View

Click here to load this message in the networking platform