Microsoft KB Archive/49670

= Using $DEBUG for Conditional Compilation =

Article ID: 49670

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 4.0
 * Microsoft FORTRAN Compiler 4.01
 * Microsoft FORTRAN Compiler 4.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN PowerStation 1.0 Standard Edition
 * Microsoft Fortran PowerStation 1.0a for MS-DOS
 * Microsoft FORTRAN PowerStation 32
 * Microsoft FORTRAN Compiler 4.0
 * Microsoft FORTRAN Compiler 4.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1

-



This article was previously published under Q49670



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 &quot;Reference&quot; 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 &quot;Language Reference&quot; 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 &quot;A&quot; or &quot;B&quot; 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 query words: kbinf 1.00 4.00 4.01 4.10 5.00 5.10

Keywords: kblangfortran KB49670

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.