DragonFly BSD
DragonFly commits List (threaded) for 2004-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/usr.bin/rev


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Tue, 14 Dec 2004 23:33:06 +0100

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



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]