BUG: #IF <System Memvar> Returns "Invalid Preprocessor..."Last reviewed: February 16, 1996Article ID: Q115953 |
The information in this article applies to:
SYMPTOMSThe compiler directives #IF ... #ENDIF used with the _DOS, _WINDOWS, _MAC, and _UNIX system memory variables generate an "Invalid preprocessor expression" error message when compiled under FoxPro for Windows and FoxPro for Macintosh. FoxPro for MS-DOS does not produce any error messages when the same code is compiled. Instead, it compiles the statement following #IF _DOS and displays "This displays only when running under DOS".
RESOLUTIONTo obtain the desired results when using preprocessor directives, run the following code in all three products:
#IF 'WINDOWS' $ UPPER(VERSION()) ? "This should display only when running under Windows" #ELIF 'MAC' $ UPPER(VERSION()) ? "This should display only when running on the Macintosh" #ELSE ? "This should display only when running under DOS" #ENDIF STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONBoth FoxPro for Windows and Macintosh return the expected results because the _DOS, _WINDOWS, _MAC, and _UNIX system memory variables are not considered preprocessor definitions since they are evaluated at run time, not compile time. The online help system for FoxPro for Windows, MS-DOS, and Macintosh contains the following warning: NOTE: Do not use system memory variables for <expN1> or <expL1>. System memory variables are not evaluated until run time.
Steps to Reproduce Problem
This displays only when running under DOS |
Additional reference words: FoxMac FoxDos FoxWin 2.50 2.50a 2.50b 2.60
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |