Why?? (prog question)

Bruce Cran bruce at cran.org.uk
Tue Mar 31 11:20:25 PDT 2009


On Tue, 31 Mar 2009 11:21:22 +0200
Polytropon <freebsd at edvax.de> wrote:

> 4. Use the predefined return codes, don't hardcode them.
>    FreeBSD has EXiT_SUCCESS and EXIT_FAILURE, they're for
>    maximum compatibility (such as with Linux). There are
>    more exit codes for differentiation, but they're specific
>    to FreeBSD, as far as I know.

Linux seems to have adopted sysexits.h too, which provides error codes
such as EX_USAGE and EX_CANTCREAT. However, in FreeBSD at least the most
common programming style is to use 1 for error and 0 for success - e.g.
from style(9):

errx(1, "number overflowed");

-- 
Bruce Cran


More information about the freebsd-questions mailing list