Non-zero exit status for clean exit

Posted by trinithis on Programmers See other posts from Programmers or by trinithis
Published on 2012-06-22T20:11:59Z Indexed on 2012/06/22 21:25 UTC
Read the original article Hit count: 394

Is it acceptable to return a non-zero exit code if the program in question ran properly? For example, say I have a simple program that (only) does the following:

Program takes N arguments. It returns an exit code of min(N, 255). Note that any N is valid for the program.

A more realistic program might return different codes for successfully ran programs that signify different things. Should these programs instead write this information to a stream instead, such as to stdout?

© Programmers or respective owner

Related posts about programming-practices

Related posts about exit-strategy