"Parahat Melayev" <pa*****@gmail.comwrites:
The C standard specifies two defines EXIT_SUCCESS and EXIT_FAILURE that
may be passed to exit() to indicate successful or unsuccessful
termination, respectively.
The use of EXIT_SUCCESS and EXIT_FAILURE is slightly more portable (to
non-Unix environments) than that of 0 and some nonzero value like 1 or
-1. In particular, VMS uses a different convention.
I would drop the word "slightly".
exit(0) is just as portable as exit(EXIT_SUCCESS); they're both
defined by the C standard to indicate successful termination.
exit(1) is non-portable, and I've seen plenty of code that uses it
incorrectly. exit(EXIT_FAILURE) (or "return EXIT_FAILURE;" within
main()) is the only portable way to indicate unsuccessful termination.
more can be found at "man 3 exit"...
Only if your system has the "man" command, and if it does it's likely
to give you system-specific information. Of course there's nothing
wrong with learning how things work on your system, but it's also
important to know what's portable and what isn't, and a
system-specific man page may or may not tell you that.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.