This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] Add caf_runtime_error to libgfortran/caf/single.c


On 07/14/2011 12:14 PM, Daniel Carrera wrote:
On 07/14/2011 12:04 PM, Tobias Burnus wrote:
I was wondering - based on the discussion - whether one should remove
the "int error" argument from caf_runtime_error and simply use "exit
(EXIT_FAILURE)" for all exit() calls in mpi.c/single.c, cf.
http://gcc.gnu.org/ml/fortran/2011-07/msg00140.html
But one can also do so as follow up patch.

You are the boss. The message I got from Nick's post is that it doesn't matter much and that you could even get surprising behaviour because EXIT_SUCCESS is not required to be zero and EXIT_FAILURE is not required to be non-zero. But maybe I missed the point. So it's up to you.

Well, for "exit(3)" one knows that one will get a surprising in Windows: An abort. While EXIT_FAILURE [but also exit(1)] have a very high change to be working (nearly) everywhere. At the end, as long as the operating system does not react in a completely odd way, the exit status does not matter - it's the problem of the caller (e.g. some script) to make use of the result. If EXIT_FAILURE is 0 and the script assumes that it is a success, it's either a fault of the script writer, or of the one putting 0 for EXIT_FAILURE into the header, or a fault of the OS designer.


Thus, I think the chance that one avoids surprises is higher with exit(EXIT_FAILURE) and one avoids having some random number (for the exit status) in the code. Users usually do not check the exact exit status value but only its 0- vs non-0-ness.

Hence, I think exit(EXIT_FAILURE) is better than the current version.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]