Recursion Not Supported by FORTRAN

ID: Q63819


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, 5.0, 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, versions 1.0, 1.0a
  • Microsoft Fortran Powerstation 32 for Windows NT, versions 1.0, 4.0


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 "Reference" manual for versions 5.0 and 5.1, pages 127, 172, 225, and 231.


  • The Microsoft FORTRAN "Language Reference" 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 "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 query words: kbinf 1.00 4.00 4.01 4.10 5.00 5.10

Keywords : kbFortranPS kbLangFortran
Version : :1.0,1.0a,4.0,4.01,4.1,5.0,5.1
Platform : MS-DOS NT OS/2 WINDOWS
Issue type :


Last Reviewed: November 2, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.