Re: the mystery of <ctrl-d>
- From: Nick Keighley <nick_keighley_nospam@xxxxxxxxxxx>
- Date: 30 Apr 2007 01:49:38 -0700
On 30 Apr, 06:39, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
Bill Pursell said:> > Keith Thompson wrote:
Bill Pursell writes:
chandanlinster wrote:
exit(EXIT_SUCCESS);
It seems weird to exit() here instead of simply returning a
value...
Why? Within the main() function, "exit(EXIT_SUCCESS)': and
"return EXIT_SUCCESS;" are (almost) exactly equivalent.
Just because it seems odd. It seems cleaner to return
than to exit, but there's no reason for that other than
aesthetics.
<snip>
exit() feels like something that should be
reserved for an error condition.
I wouldn't dream of using it for that purpose. That's what:
return EXIT_FAILURE;
is for. In fact, I can't think of any use whatsoever for exit().
terminating the program somewhere other then main().
As a one -exit-per-funtion person I suspect you wouldn't approve.
:-)
--
Nick Keighley
"The Dinosaurs have come and gone,
we Theriodonts remain"
.
- Follow-Ups:
- Re: the mystery of <ctrl-d>
- From: Richard Heathfield
- Re: the mystery of <ctrl-d>
- References:
- the mystery of <ctrl-d>
- From: chandanlinster
- Re: the mystery of <ctrl-d>
- From: Bill Pursell
- Re: the mystery of <ctrl-d>
- From: Keith Thompson
- Re: the mystery of <ctrl-d>
- From: Bill Pursell
- Re: the mystery of <ctrl-d>
- From: Richard Heathfield
- the mystery of <ctrl-d>
- Prev by Date: Re: gets() is dead
- Next by Date: Re: break statement in a for loop
- Previous by thread: Re: the mystery of <ctrl-d>
- Next by thread: Re: the mystery of <ctrl-d>
- Index(es):
Relevant Pages
|