prototype my function, please

Karl Heuer karl at haddock.ima.isc.com
Tue Jun 5 11:37:14 AEST 1990


In article <239 at taumet.COM> steve at taumet.UUCP (Stephen Clamage) writes:
>In article <1990Jun2.091606.9125 at druid.uucp> darcy at 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 at ima.ima.isc.com or harvard!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list