cvs commit: src/usr.bin/rev

Joerg Sonnenberger joerg at britannica.bec.de
Tue Dec 14 14:33:32 PST 2004


On Tue, Dec 14, 2004 at 03:42:36PM -0600, Jason Smethers wrote:
> Why not simply use a return statement to exit main()? How antiquated a 
> system do we expect the code in the project to run on? What systems out 
> there don't support the functionality of exiting the program with a 
> return statement instead of a call to exit()?

It's not about supporting it or not. It works fine either way.
The advantage is that exit() pretty much means exactly that, exit the
program and not return from some mysterious function. The advantage of
return is that it is the normal way of leaving a stack frame. Both
have there uses.

> Second, OR'ing instead of adding the value returned by dorev() will 
> achieve the functionality you want without doing any tests.

It's nice when debugging code to be able to tell how many operations
already failed :)

Joerg

> 
> - Jason





More information about the Commits mailing list