DOCERR: RETURN Statement Not Supported in Main Program Unit

Last reviewed: March 8, 1996
Article ID: Q148186
The information in this article applies to:
  • Microsoft Fortran PowerStation for Windows 95 and Windows NT, version 4.0

SUMMARY

The Microsoft Fortran PowerStation for Windows 95 and Windows NT, version 4.0, Reference Manual, Page 453, incorrectly describes the effect of using a RETURN statement in the main program unit. It says, "A RETURN statement in the main program is treated as a STOP statement with no message parameter." This reference to and usage of RETURN statements is considered obsolete. Instead, a RETURN statement in the main program unit will cause the following compile-time error:

   error FOR2718: RETURN is only allowed in SUBROUTINEs and FUNCTIONs

MORE INFORMATION

The following code illustrates the problem:

C Compile options needed: none

      print *, 'hello, world'
      return         ! Compilation error
      end


Additional reference words: 4.00
KBCategory: kbprg kbdocerr
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: March 8, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.