home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!news.funet.fi!hydra!klaava!wirzeniu
- From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
- Newsgroups: comp.lang.c
- Subject: Re: How to use 'return' in c?
- Message-ID: <1992Nov6.144715.28006@klaava.Helsinki.FI>
- Date: 6 Nov 92 14:47:15 GMT
- References: <1992Oct29.025437.9289@nuscc.nus.sg> <1992Nov2.203701.162@ipact.com> <1992Nov4.231347.26999@u.washington.edu>
- Organization: University of Helsinki
- Lines: 17
-
- With non-standard implementation there are no guarantees as to what any
- particular return value of main or value passed to the exit function
- means. Traditionally, especially in Unix and systems mimicing Unix, the
- code 0 has meant success, and small positive integers have been used to
- show various error codes (the exact meaning of each code depending on
- the particular program). Other systems may have had different
- conventions. In summary, exit codes were non-portable.
-
- The standard improves on this situation a) by specifying that 0 always
- means success, and b) by introducing the macros EXIT_SUCCESS and
- EXIT_FAILURE (in <stdlib.h>) with the obvious meaning. Thus, using
- standard C you can always rely on ``exit(EXIT_SUCCESS)'' to indicate
- success to the operating system, and ``exit(EXIT_FAILURE)'' to indicate
- failure.
-
- --
- Lars.Wirzenius@helsinki.fi (finger wirzeniu@klaava.helsinki.fi)
-