FIX: #IF and #ENDIF Behavior in FoxPro Differs from dBASE

Last reviewed: October 20, 1997
Article ID: Q112834
2.60    | 2.60
WINDOWS | MS-DOS kbprg kbbuglist kbfixlist

The information in this article applies to:

  • Microsoft FoxPro for Windows, version 2.6
  • Microsoft FoxPro for MS-DOS, version 2.6

SYMPTOMS

#IFDEF works differently in dBASE and FoxPro. FoxPro cannot use #IFDEF and #IFNDEF. Instead, FoxPro uses #IF, which takes only a logical value or a number (0 = false, 1 = true).

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in FoxPro 2.6a for Windows and MS-DOS.

RESOLUTION

To work around this problem, issue an #IF statement instead. For example:

   #IF D=1
      ? "TEST"
   #ENDIF

MORE INFORMATION

The following code demonstrates how #IFDEF works in dBASE and FoxPro:

   *** #IFDEF Example ***
   #IFDEF d
       ? "TEST"
   #ENDIF

This code works properly in dBASE and does not print "TEST". However, in FoxPro, "TEST" is printed. This means that any dBASE code that uses #IFDEF will produce unexpected results when executed in FoxPro.


Additional reference words: FoxDos FoxWin 2.60 buglist2.60 fixlist2.60a
KBCategory: kbprg kbbuglist kbfixlist
KBSubcategory: FxprgGeneral
Solution Type : kbfix


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: October 20, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.