Re: Exit code with Fortran 90



In article <13q13hiaul4q183@xxxxxxxxxxxxxxxxxx>,
Walter Spector <w6ws_xthisoutx@xxxxxxxxxxxxx> wrote:
Andrea Francia wrote:
If I use the istruction
stop n
where n is a integer I found that the program terminate with n as exit
code.

I see that this happen compiling when I use the GNU Fortran compiler
(gfortran).

Is this behaviour standard, or it is a special behaviour of gfortran?

As Dan says, it is not required by the Fortran Standard per se.
However the POSIX Fortran Binding (1003.9-1992) does specify this
behavior (for small integer values.) As desirable as the feature
is, some compilers do it and some don't.

Even writing the code in octal is standard-conforming, e.g. NAG f95:

mahoe{~/Jfh} % cat stop666.f90
PRINT *,'Next statement is STOP',666
STOP 666
END
mahoe{~/Jfh} % nagf95 stop666.f90 ; ./a.out
Next statement is STOP 666
STOP: 1232
mahoe{~/Jfh} %

-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@xxxxxxxxx phone (+64)(4)463 5662 fax (+64)(4)463 5045
.



Relevant Pages

  • Re: SGI fortran compilation problem
    ... > PGI Fortran and Intel Fortran have no trouble compiling it. ... the TIME procedure is not standard Fortran. ... recommendation to use the standard intrinsics instead of ...
    (comp.lang.fortran)
  • Re: Exit code with Fortran 90
    ... where n is a integer I found that the program terminate with n as exit code. ... I see that this happen compiling when I use the GNU Fortran compiler. ... Thanks everyone for the replies, now I know that this behaviour is not part of the Fortran 95 standard, but it is part of the 1003.9-1992 standard and may be not avaialable on each Fortran 95 implementation. ...
    (comp.lang.fortran)
  • Re: Tool to determine which headers are needed/not_needed?
    ... This would be helpful in removing header ... Not if the OP is compiling with C89, the most commonly implemented standard, or something close to C89 which is the most common default mode for compilers. ... There is no requirement on the commonly implemented standard to diagnose the lack of a declaration. ...
    (comp.lang.c)
  • Re: Integer Coersion
    ... It's new to people who come to fortran that "compiling" is a word we're going to do without. ... I tried to track "initialization expession" down in 04007.pdf, but the notation was new and I ended up spending fifteen minutes looking for 126. ... It's just that the standard has chosen ...
    (comp.lang.fortran)
  • Re: constantp values always available at macro expansion time?
    ... lisp would have underlying definitions of the defining macros ... Currently, there is only one standard: ... > X for platform B with lisp Y on platform A. ... is _not_ portably compiling sbcl; ...
    (comp.lang.lisp)