Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: prototype my function, please Message-ID: <16790@haddock.ima.isc.com> Date: 5 Jun 90 01:37:14 GMT References: <1231@wet.UUCP> <0705@sheol.UUCP> <1990May31.135230.242@druid.uucp> <236@taumet.COM> <1990Jun2.091606.9125@druid.uucp> <239@taumet.COM> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 19 In article <239@taumet.COM> steve@taumet.UUCP (Stephen Clamage) writes: >In article <1990Jun2.091606.9125@druid.uucp> darcy@druid.UUCP (D'Arcy J.M. Cain) writes: >>int main(int argc, char **argv) { ... exit(0); } >>[complains about int-valued function that seems to return void. But if you >>add a `return 0',] you now have added code (which won't be optimised >>out) which has no other purpose than to shut the compiler up. ... > >Are you really concerned about one return statement in one function in >the entire program taking up code space but never being executed? On the implementation that I normally use, exit() is known to be a dead function. Hence, adding a `return' statement would *create* a warning about unreachable code. Besides which, you can't just write `exit(0); return 0;'. You also have to include a comment that says why you're doing something so silly, lest the next person to read the code think you did it out of ignorance. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint