Article View: comp.std.c
Article #3926Re: EXIT_FAILURE problem
From: Tanmoy Bhattacharya
Date: Tue, 05 Sep 1995 13:39
Date: Tue, 05 Sep 1995 13:39
35 lines
2374 bytes
2374 bytes
In article <42fv9f$ld2@caip.rutgers.edu>, halasz@caip.rutgers.edu writes: |> In article <42eeoo$foo@goanna.cs.rmit.edu.au>, ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) writes |> : This is a perfect example of why the C standard got it just right. |> |> Can't be, for the standard makes the mistake of specifying a real constant, |> to wit 0, for to mean a particular status, instead of hiding it all under |> macros, EXIT_SUCCESS, EXIT_FAILURE, and so on. No it doesn't any more than it mandates that a null pointer is all bits zero (because char *ptr=0 is allowed), or that it mandates that char and float have the same representation (because float x='\0') is allowed. `exit' is a function in the C library and parameters to it can be freely specified by the C standard. In particular, this parameter need not have anything to do with what the operating systems calls the exit status, error level, return code or whatever else (except semantically). This parameter currently either implies success or failure, or implies an implementation defined status. I too believe the standard got it wrong: No macros were ever needed :-) exit(0) for success and exit(1) for failure and all other values implementation defined would have avoided a lot of this needless confusion. (By the way, why wasn't this solution chosen? Was there a vast amount of code which used exit(1) for some kind of success?) Cheers Tanmoy -- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242) Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87544-0285,USA H:#3,802,9 St,NM87545 Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>, <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/ internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html> fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
Technical Details
Message-ID:
<42hjuu$4f4@newshost.lanl.gov>Path:
arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoyReferences:
<jbundyDCw7uo.9sz@netcom.com> <danpop.807723059@rscernix> <42eeoo$foo@goanna.cs.rmit.edu.au> <42fv9f$ld2@caip.rutgers.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoy From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) Newsgroups: comp.std.c Subject: Re: EXIT_FAILURE problem Date: 5 Sep 1995 13:39:42 GMT Organization: Los Alamos National Laboratory Distribution: world Message-ID: <42hjuu$4f4@newshost.lanl.gov> References: <jbundyDCw7uo.9sz@netcom.com> <danpop.807723059@rscernix> <42eeoo$foo@goanna.cs.rmit.edu.au> <42fv9f$ld2@caip.rutgers.edu> NNTP-Posting-Host: qcd.lanl.gov