Microsoft KB Archive/63819

= Recursion Not Supported by FORTRAN =

Article ID: 63819

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 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 PowerStation 32

-



This article was previously published under Q63819



SUMMARY
Neither the FORTRAN 77 language, nor the Microsoft FORTRAN 77 Optimizing Compilers, Microsoft FORTRAN Compilers prior to FORTRAN PowerStation 4.0, supports recursion. For more information, see one of the following references:


 * Microsoft FORTRAN PowerStation Language Help, topics: CALL, ENTRY, FUNCTION, and SUBROUTINE.
 * The Microsoft FORTRAN &quot;Reference&quot; manual for versions 5.0 and 5.1, pages 127, 172, 225, and 231.
 * The Microsoft FORTRAN &quot;Language Reference&quot; manual for versions 4.0 and 4.1, pages 174, 218, and 273.
 * The ANSI X3.9-1978 FORTRAN 77 standard, page 15-1 (section 15.2).

NOTE: For more information on recursion with Microsoft FORTRAN 32, version 4.0, consult the FORTRAN PowerStation 4.0 manual, page 144.



MORE INFORMATION
The FORTRAN 77 standard includes the following statement regarding recursion:

A subprogram must not reference itself, either directly or indirectly.

In direct recursion, a subprogram calls itself. According to page 231 of the &quot;Reference&quot; manual, &quot;any attempt at direct recursion results in a compile-time error [F2600: name : directly recursive].&quot;

In indirect recursion, a subprogram calls another subprogram that in turn calls the original subprogram before the first subprogram completed execution. According to page 231 of the &quot;Reference&quot; manual, Microsoft FORTRAN does not detect indirect recursion.

If an application uses indirect recursion, compile the subprograms involved with the /4Ya compiler option switch to place all local variables on the stack. Doing so provides each instance of the subroutine with its own set of local variables.

NOTE: The Fortran 90 standard includes the following statement regarding recursion:

&quot;Transcending a long-standing tradition, Fortran 90 procedures may be recursive.&quot;

Additional query words: kbinf 1.00 4.00 4.01 4.10 5.00 5.10

Keywords: kblangfortran KB63819

-

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

© Microsoft Corporation. All rights reserved.