Article View: comp.std.c
Article #3932Re: EXIT_FAILURE problem
From: Tanmoy Bhattacharya
Date: Wed, 06 Sep 1995 14:07
Date: Wed, 06 Sep 1995 14:07
71 lines
4188 bytes
4188 bytes
In article <42irjd$jir@caip.rutgers.edu>, halasz@caip.rutgers.edu writes: <snip: talking about exit code> |> : This parameter currently either implies success or failure, or implies an |> : implementation defined status. |> No: it describes success, failure, and 0. Wrong! Currently the parameter of exit _implies_ success or failure of the program; or it implies an implementation defined status. I do not understand your claim that it `describes' 0. A parameter to an exit function cannot describe: it can imply. The standard can describe: but its description is exactly as I wrote: there are two ways to imply success, one to imply failure, and numerous left to the implementation. |> |> : 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. |> What confuzion, except among those who chooz not to understand that use of |> constants in such contexts as this has nothing good to sai for it? _Why_ are constants bad in this context? You have claimed for a long time that they are. If this is something other than a religion in which I do not participate, I should be able to understand your point. _Why_ is it acceptable for 0 to stand for a null pointer constant on a machine in which a null pointer is FFFF, _why_ is it understandable for 0 to be false and non-zero to be true even on a machine which has `jump _if_ zero' as its only machine instruction; and, yet, _why_ is it not acceptable to have exit(0) stand for successful exit on an OS where return status of 0 implies failure? (Yes you claimed this was a meaningless analogy: but assertion is a very poor way to prove something, even poorer than analogy.) |> Carrieing out your suggestion would mean that no program with more than |> passind use of exit-status would uze "exit". Instead, the programmer writes How do macros help in this? You can have only a finite number of macros _defined_ by the standard, the rest would be implementation defined. Two of these macros will possibly indicate the general notions of success and failure. Why do we need macros for them? We could as well use 0 and 1 for these cases and macros for the rest. And why macros either? Just plain integers would do. |> his own system-dependent one, that turns the exit-status that he wishes his |> program to return into the real exit-status by calling the relevant |> system-dependent exit-routine. What do you think the C library function `exit' is for. The standard is giving the implementation the opportunity of helping all its programmers by writing a C library function called `exit' which `turns that exit-status that he wishes his program to return into a real exit-status by calling the relevant system-dependent exit-routine'. I do not understand why every programmer will bother to write this routine when `exit' already exists for precisely this task: The input of exit is a high level description of what is needed, coded into an integer in an implementation defined fashion: and the `output' is an appropriate error code returned to the system. 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:
<42k9vn$5co@newshost.lanl.gov>Path:
arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoyReferences:
<jbundyDCw7uo.9sz@netcom.com> <danpop.807723059@rscernix> <42hjuu$4f4@newshost.lanl.gov> <42irjd$jir@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: 6 Sep 1995 14:07:51 GMT Organization: Los Alamos National Laboratory Distribution: world Message-ID: <42k9vn$5co@newshost.lanl.gov> References: <jbundyDCw7uo.9sz@netcom.com> <danpop.807723059@rscernix> <42hjuu$4f4@newshost.lanl.gov> <42irjd$jir@caip.rutgers.edu> NNTP-Posting-Host: qcd.lanl.gov