Subject: Re: Answer to "which echo.c"
To: Peter Seebach <firstname.lastname@example.org>
From: David Maxwell <email@example.com>
Date: 12/09/1999 23:04:40
On Thu, Dec 09, 1999 at 08:44:56PM -0600, Peter Seebach wrote:
> Actually, you can be 100% confident that every C environment in the world
> treats 'return n' in main the same as 'exit(n)'[*][**].
It was a trite, contrived example, to be sure. Yes, any C environment
should clean up after itself.
Let's suppose the program calls some function other than main - as
the last call before the closing brace of main(). You could just leave
it, and let it return() by default, you could place an exit() at the end,
or you might put an exit in the called function (that's the least
appropriate from my point of view, except in some very specific case).
My example was meant to say "It is good to explicitly specify when
execution will terminate - for the same reason it's good to say
/* NOTREACHED */
David Maxwell, firstname.lastname@example.orgemail@example.com --> Mastery of UNIX, like
mastery of language, offers real freedom. The price of freedom is always dear,
but there's no substitute. Personally, I'd rather pay for my freedom than live
in a bitmapped, pop-up-happy dungeon like NT. - Thomas Scoville