Xref: utzoo comp.lang.misc:2460 comp.lang.c:15271 comp.lang.c++:2360 Path: utzoo!utgpu!attcan!uunet!lll-winken!ames!husc6!m2c!ulowell!cg-atla!duane From: duane@cg-atla.UUCP (Andrew Duane) Newsgroups: comp.lang.misc,comp.lang.c,comp.lang.c++ Subject: Re: Yet Another Lint Foul-up Summary: $status and exit codes Keywords: Idle curiosity. Message-ID: <6419@cg-atla.UUCP> Date: 6 Jan 89 14:44:54 GMT References: <1298@tank.uchicago.edu> Organization: Agfa Compugraphic Division, Wilmington, Mass Lines: 38 In article <1298@tank.uchicago.edu>, vevea@paideia.uchicago.edu (Jack L. Vevea) writes: > > I've passively watched the discussion of lint's problems with > exit(0) from main(), and find myself wondering why it matters. I use > lint to check my code, but I've gotten into the habit of automatically > ignoring certain output, including 'warning: main() returns a random > value to the invocation environment.' Being primarily a psychometrician, > and not a professional C (or any other language) programmer, I find myself > wondering if some of you out there are working under conditions in which > some higher authority requires you to produce a clean lint run as > evidence of good coding. Otherwise, it would seem to me that any > concern with the message would be evidence of your being a slave to > lint; why else be concerned when you _know_ that the warning is > inconsequential? But sometimes the exit value of a program is important. I regularly use many shell scripts that require correct (and explicit) exit codes. Also, the system() library routine returns (in a contorted fashion) the exit code of the program; thus other programs can depend on it. GREP is a good example of this. If "main() returns a random value to the invocation environment" then these scripts may break unpredictably; worse, they may WORK unpredictably. And you never know when some little helper program may be used in such a script. Big programs are not immune, either. Someday, someone may want to wrap up that huge database program in a little helper script for novices, and need that exit value. Andrew L. Duane (JOT-7) w:(508)-658-5600 X5993 h:(603)-434-7934 Compugraphic Corp. decvax!cg-atla!duane 200 Ballardvale St. ulowell/ \laidback Wilmington, Mass. 01887 cbosgd!ima/ \cgeuro Mail Stop 200II-3-5S ism780c/ \wizvax Only my cat shares my opinions, and she hasn't returned to the invocation environment yet.