Recursion Not Supported by FORTRAN

ID: Q63819

4.00 4.01 4.10 5.00 5.10 1.00 1.00a | 4.10 5.00 5.10 | 1.00 4.00

MS-DOS                              | OS/2           | WINDOWS NT
kbprg

The information in this article applies to:

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:

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 "Reference" manual, "any attempt at direct recursion results in a compile-time error [F2600: name : directly recursive]."

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 "Reference" 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:

   "Transcending a long-standing tradition, Fortran 90 procedures may be
   recursive."

Additional reference words: kbinf 1.00 4.00 4.01 4.10 5.00 5.10 KBCategory: kbprg KBSubcategory: FORTLngIss
Keywords          : kbFortranPS kbLangFortran 
Version           : 4.00 4.01 4.10 5.00 5.10 1.00 1.
Platform          : MS-DOS NT OS/2 WINDOWS

Last Reviewed: December 13, 1995