return value from fortran program
Andrew Pinski
pinskia@gmail.com
Tue Sep 16 21:02:00 GMT 2008
On Tue, Sep 16, 2008 at 1:59 PM, Tobias Burnus <burnus@net-b.de> wrote:
> RadSurfer wrote:
>> How can we pass the integer value we want to the
>> calling shell, as a 'return' or 'error value' ?
>
> The Fortran 2008 way of doing so is:
>
> STOP <integer expression>
>
> Caveats:
> a) Integer expressions are not yet supported
> by most compilers, only integer literals
> (that should be OK as well)
> b) Some compilers such as NAG f95 don't use
> the passed integer as return value
> (That is recommended only since Fortran 2008)
> c) Not only the return value is used, but
> e.g. "STOP 5" or "5" or "STOP: 5" is additionally
> printed.
>
> gfortran (and other vendors) additionally support:
>
> call exit(<integer expression>)
Plus can't you use the C bindings in 2003 to call the C function exit?
Thanks,
Andrew Pinski
More information about the Fortran
mailing list