what is the meaning of exit()?

O

ozbear

On Fri, 28 Oct 2005 22:08:12 +0100, Mark McIntyre

Yes, and returning arbitrarily chosen values can lead to unexpectedly
excited users...
<snip>

"Unexpectedly excited users"...I like it!

Oz
 
P

Peter Nilsson

Jordan said:
Whatever you want. Zero means success. Anything else is considered
an error. You get to make up the error codes. It's YOUR program.

Incorrect. For example, on many systems an attempt to exit with the
code 256 [or any multiple of such] will result in reporting a
"success" [0 mod 256] to the operating system.

Only EXIT_FAILURE is guaranteed by the standard.
On POSIX and Windows you are guaranteed one byte.

It should be noted that there is nothing in the standard which
states that the status returned to the host must be in the form of
a number.

On many old Macs tools for instance, ExitToShell(void) gets called
irrespective of the return value of main or the parameter to exit().
But it's not too difficult to imagine a system where the runtime
cleanup checks the main/exit value and calls two different traps/rom
routines to allow the host to proceed, and neither call would
require a parameter based on the main/exit value.
 
R

Richard Bos

Mark McIntyre said:
On Fri, 28 Oct 2005 16:36:06 GMT, in comp.lang.c ,


Its large, pink and not really there. Reminds me of something...

If a programmer is about to dismiss a problem of unportability or
unreliability as a pink elephant, he would generally do well to make
sure that it is not the colour alone that is the hallucination, and that
he is not about to be shat upon from a great height.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top