Using $DEBUG for Conditional Compilation

Last reviewed: December 11, 1995
Article ID: Q49670
The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS and OS/2, versions 4.0, 4.01, 4.1, 5.0, 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, versions 1.0 and 1.0a
  • Microsoft FORTRAN PowerStation 32 for Windows NT, version 1.0 and 4.0

SUMMARY

In code developed with the Microsoft FORTRAN compiler, you can use the $DEBUG metacommand to perform conditional compilation. According to the last paragraph on page 286 of the Microsoft FORTRAN "Reference" manual for versions 5.0 and 5.1:

   If the optional string is specified [in the $DEBUG metacommand],
   the characters in string specify that lines with those characters
   in column 1 are to be compiled into the program. Case is not
   significant. Note that the letter C always indicates a comment
   line; therefore, if string contains a C, the C is ignored.

MORE INFORMATION

For more information on using the $DEBUG metacommand to perform conditional compilation, see page 286 of the Reference manual for versions 5.0 and 5.1 or page 289 of the Microsoft FORTRAN "Language Reference" manual for versions 4.0 and 4.1.

For more information on conditional compilation, see the documentation for the /4cc compiler option switch.

In the following code example, the compiler processes only the lines that have either the letter "A" or "B" in column one; the other lines are ignored as comments.

Sample Code

C Compile options needed: None

$DEBUG:'AB' A J = 3 D J = 4 B J = J**2 E J = SQRT(J) C J equals 9, because only statements C A and B are compiled.

      PRINT *, J
      END


Additional reference words: kbinf 1.00 4.00 4.01 4.10 5.00 5.10
KBCategory: kbprg
KBSubcategory: FORTLngIss


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: December 11, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.