Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!ima!haddock!karl From: karl@haddock.UUCP (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: impossible problem for find(1)? Message-ID: <474@haddock.UUCP> Date: Mon, 4-May-87 12:23:39 EDT Article-I.D.: haddock.474 Posted: Mon May 4 12:23:39 1987 Date-Received: Tue, 5-May-87 03:14:22 EDT References: <2645@phri.UUCP> <6454@mimsy.UUCP> <5797@brl-smoke.ARPA> <5815@brl-smoke.ARPA> <7215@orchid.UUCP> <5824@brl-smoke.ARPA> Reply-To: karl@haddock.ISC.COM.UUCP (Karl Heuer) Organization: Interactive Systems, Boston Lines: 26 Summary: clarification: int vs. void vs. dead In article <5824@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >I said what I meant. I did not say that the main() function returned. >Lint warns about an int-valued function that doesn't return an int value. >main() is an int-valued function. Why do I have to spell this out? Let's rephrase. There are three types of function under consideration: "int", "void", and "dead". The last refers to a function that never returns at all, such as exit(), longjmp(), and dpANS abort(); unfortunately C has no explicit declaration for this. You seem to be saying that it is incorrect to have a dead function declared int. I disagree, because I think the acting definition of an int function is "all return paths return an int type"; this is vacuously true in the case of a dead function. (Note that the generalization of this implies that *any* declaration would be valid, except that main() by definition is supposed to be declared int.) It is quite possible that some versions of lint disagree with me here, and insist that dead functions be declared void. Does yours complain, or is this a theoretical argument? (Most versions of lint -- and X3J11, as of May86 -- don't even insist that void functions be declared void.) I would hope that such a lint would make an exception for main(), since it's so common. And it's *not* an error to never return from main()! Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint