On Fri, 18 Jan 2013, Bruce Evans wrote:

The orignal BSD style guide (/usr/src/admin/style/style) actually says
not to use [non-arbitrary] sequential values to indicate all exit points:
...
but was changed in FreeBSD to say something quite different:
...
and then was changed to say something even further removed from the original:
...
I thought that it was changed to at least mention the Standard but not
very useful EXIT_SUCCESS and EXIT_FAILURE.  It should also not disallow
an error code of 2 which is often used for more severe errors.

PS: I forgot to mention the NetBSD style guide (/usr/src/share/misc/style).
At least the 2005 version of it says:

%       /*
%        * Exits should be EXIT_SUCCESS on success, and EXIT_FAILURE on
%        * failure.  Don't denote all the possible exit points, using the
%        * integers 1 through 127.  Avoid obvious comments such as "Exit
%        * 0 on success.". Since main is a function that returns an int,
%        * prefer returning from it, than calling exit.
%        */
%       return EXIT_SUCCESS;

It's interesting that it covers another point in this thread (of whether to
return or exit from main()).  I like returning from main(), but don't like
requiring it.

This and other parts of the NetBSD version also remove the examples and
the requirement of spaces around return values.

Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to