(j3.2006) Note 8.30 in F2008

Malcolm Cohen malcolm
Mon Jun 10 22:50:31 EDT 2013


>An interesting question arose regarding the suggestion in Note 8.30 that
>the <stop-code> be returned as the exit status, or that the exit status
>be zero if no <stop-code> is supplied.  The way it is written, the
>recommendation applies equally to STOP and ERROR STOP.  For STOP it
>makes sense.

Actually, if we think that STOP is normal termination (which it is) and ERROR 
STOP is error termination (which it is), returning the user-supplied value in 
"STOP 123" or "ERROR STOP 0" does not really make sense either.

(Returning the user-supplied value made more sense before we added ERROR STOP of 
course.)

>   Did we really mean that for ERROR STOP, where the default
>exit status would seem more naturally to be the value corresponding to
>"abort", such as 1, and not 0.

1 would not be a particularly good choice here (though it is better than 0).  An 
exit status of 1 is considered successful on some systems...

>   Similarly, if the user wrote
>
>ERROR STOP 0
>
>does it make sense to have the impression of "success" returned as the
>exit status?
>
>There seems to be a disconnect with user expectations here, particularly
>in the default case.

Yes there is a disconnect, but it is just about as strong for "STOP nonzero" as 
it is for "ERROR STOP zero".  There is no perfect solution for combining an 
arbitrary user-defined stop code (the long-standing effect of STOP) and the 
trend for most modern operating systems both to have a limitation on what codes 
it can handle (sometimes only 1 byte, less even that the 5 digits of old 
Fortran) and to impose an interpretation of "success"/"failure" on the value.

When the user has explicitly specified a stop-code, I think that the best we can 
do is to respect that, especially since there is no other mechanism provided for 
a "process exit status".

You have a good point for "ERROR STOP" without a numeric stop-code, and I would 
suggest that the recommendation here should be a "nonzero processor-dependent 
value that indicates abnormal termination".

Another thing is that these recommendations ought to be in normative text 
anyway.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list