Difference Between EVALUATE() and Macro Substitution

Last reviewed: June 27, 1995
Article ID: Q96294
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

The EVALUATE() function and macro substitution (&) are used to place the value of a variable in a FoxPro command. Both methods enable the variable being used to be evaluated during execution time. The main difference between these methods is that the FoxPro compiler compiles the EVALUATE() term before execution.

In both methods, the value of the variable being referenced can change during execution. The FoxPro compiler interprets macro substitution as a reference to a variable that will not be resolved until the program is executed. In the case of the EVALUATE() function, the FoxPro compiler compiles the EVALUATE() call because it assumes the variable will be correctly assigned the value during execution.

Because it is compiled, the EVALUATE() function method executes faster than the macro-substitution method.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a evaluate speed
performance
KBCategory: kbprg
KBSubcategory: FxprgMacrosub


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.