'exit(1);' considered useless (slight flame)

Gordon Moffett gam at proper.UUCP
Sat Feb 4 06:18:28 AEST 1984


Indeed, the example given (with no error message printed out) was
contrived and unforgivable practice.

However, why shouldn't errno be used as an exit status indicator?
At least within Unix-variants, those values are quite specific, and
readily looked up in the manuals.

And, as I implied in my original article, why not more use of perror(3)?
I find error messages such as:

	"can't open file"

are frustratingly trite (and all too common), when one could have easily
used perror(3) to produce more meaningful messages as:

	"no such file or directory"
or	"permission denied"
or	"too many open files"

which would help speed up tracking down the error.

(and of course, including the name of the file in the error message
 would be nice).

By this article, I am seeking to make more programmers aware of the
importance of good error messages, so as to make all our work easier.
-- 
Gordon A. Moffett
	{ allegra, decvax!decwrl } !amd70!proper
	hplabs!intelca!proper!gam



More information about the Comp.unix mailing list