Re: the mystery of <ctrl-d>



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"

.



Relevant Pages

  • Re: NRA car air fresheners
    ... Buerste wrote: ... little comfortable pop gun may get you killed. ... Anything under a .357 is a hope and a dream. ...
    (rec.crafts.metalworking)
  • Re: not post booting
    ... Buy a new motherboard, ... These fancies arise in the soul, ... is but a dream within a dream. ...
    (alt.os.windows-xp)
  • Re: PSU fan
    ... vermin, and whose partner is a chippy with a satiny fuzzy puddle, wrote ... These fancies arise in the soul, ... is but a dream within a dream. ...
    (uk.comp.homebuilt)
  • Re: Fact -- a useless concept
    ... experience as our awake state is a dream, guided by sensory impressions ...
    (talk.origins)
  • Re: You know if you are a guy if...
    ... we were gland to have it........ ... 30 grit sandpaper woulda been a dream, ...
    (rec.crafts.metalworking)