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?
On 2008-01-30 07:12:45 -0500, Andrea Francia
<afra...@galielianplus.dot_it> said:
This behavior is unspecified by the f90/95/2003 standard.
These standards have no idea what an exit code is,
nor what a process is, and so on.
It is a recommendation, with caveats, in the f08 draft.
--
Cheers!
Dan Nagle
The standard only says:
"...the stop code, if any, is available in a processor-dependent manner."
And I know at least one implementation (VMS DEC/HP Fortran) which
just displays the code (or string), and does not pass it to program exit
status.
--
Joseph Huber - http://www.huber-joseph.de
--
Gary Scott
mailto:garylscott@sbcglobal dot net
Fortran Library: http://www.fortranlib.com
Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html
If you want to do the impossible, don't hire an expert because he knows
it can't be done.
-- Henry Ford
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.
W.
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....@vuw.ac.nz phone (+64)(4)463 5662 fax (+64)(4)463 5045
hi Thanks dude . because of ur instruction "stop n" i cleared one of
the requirements in my proj.I think this is a standard command . I am
using Visual Fortran 6.6 and it shows the same behaviour.
> because of ur instruction "stop n" i cleared one of
> the requirements in my proj.I think this is a standard command . I am
> using Visual Fortran 6.6 and it shows the same behaviour.
The statement (not "command", by the way)
stop <n>
is indeed standard syntactically. However, as several people have noted,
the current Fortran standard does *NOT* specify that it has anything to
do with a program exit code. Dan, who first mentioned that in this
thread, happens to be the chair of the standards committee. He does know
at least a little about the subject. (Hi, Dan.)
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
Yes, that is a common usage. I do it all the time. If your compiler
doesn't support it 1) complain to the vendor, 2) use a file, pipes, DDE,
or some other method to pass the exit code.
Sending the stop code to the OS as an exit status is not now part of the
Fortran standard.
However, Fortran 2008 will include an enhanced STOP statement. Two of the
enhancements include displaying the stop code on ERROR_UNIT and using it as the
process exit status, if the processor has such a concept. The details are in J3
paper 05-231r4.
--
Craig Dedo
17130 W. Burleigh Place
P. O. Box 423
Brookfield, WI 53008-0423
Voice: (262) 783-5869
Fax: (262) 783-5928
Mobile: (414) 412-5869
E-mail: <cd...@wi.rr.com> or <cr...@ctdedo.com>
No. This is a common misconception. Where the stop code goes is
processor-dependent. Here is the relevant quote from section 8.4 of the Fortran
2003 standard.
[Begin quote from Fortran 2003]
Exection of a STOP statement causes normal termination (2.3.4) of execution of
the program. At the time of termination, the stop code, if any, is available in
a processor-dependent manner. Leading zero digits in the stop code are not
significant. If any exception (14) is signalling, the processor shall issue a
warning indicating which exceptions are signalling; this warning shall be on the
unit identified by the named constant ERROR_UNIT from the ISO_FORTRAN_ENV
intrinsic module (13.8.2.2).
[End of quote from Fortran 2003]
--
Gary Scott
mailto:garylscott@sbcglobal dot net
Fortran Library: http://www.fortranlib.com