Preprocessor Directives Incorrect in "Language Tips" HelpLast reviewed: June 27, 1995Article ID: Q118617 |
The information in this article applies to:
In the "Language Tips" section of the online Help file, under the "Tips and Tricks" topic, the second paragraph under the "Preprocessor Directives" topic incorrectly states the following:
This code would not work because _DOS would be changed to .T. and _WINDOWS would be changed to .F. so that the code could never work properly again. Instead use the following: #IF "Win" $ VERS() #DEFINE windows_code .T. #ELIF "Mac" $ VERS() #DEFINE mac_code .T. #ELIF "Unix" $ VERS() #DEFINE unix_code .T. #ELSE #DEFINE dos_code .T. #ENDIF #IF windows_code ? "Compiled under WINDOWS" #ELIF dos_code ? "Compiled under DOS" #ENDIFThis resolution code is incorrect because FoxPro does not allow nested preprocessor directives. When you compile the code above, it will create an .ERR file with the same name as the source file if the .ERR File option is selected in the Compile dialog box. The *.ERR file will log the following errors:
#elif "Mac" $ VERS() Error in line 3: Mismatched #if/#elif/#else/#endif. #elif "Unix" $ VERS() Error in line 5: Mismatched #if/#elif/#else/#endif. #else Error in line 7: Mismatched #if/#elif/#else/#endif. #endif Error in line 9: Mismatched #if/#elif/#else/#endif.The correct resolution code is:
#DEFINE win_code "Win" $ VERS() #DEFINE mac_code "Mac" $ VERS() #DEFINE unix_code "Unix" $ VERS() #DEFINE dos_code NOT("Win" $ VERS() OR "Mac" $ VERS() ; OR "Unix" $ VERS())) #IF win_code ? "Compiled under WINDOWS" #ELIF dos_code ? "Compiled under DOS" #ENDIF |
Additional reference words: FoxMac FoxDos FoxWin 2.50 2.50a 2.50b 2.50b
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |