prototype my function, please
e89hse at rigel.efd.lth.se
e89hse at rigel.efd.lth.se
Wed Jun 6 10:40:39 AEST 1990
In article <239 at taumet.COM>, steve at taumet.COM (Stephen Clamage) writes:
>In article <1990Jun2.091606.9125 at druid.uucp> darcy at druid.UUCP (D'Arcy J.M. Cain) writes:
>> ...
>>#include <stdio.h>
>>int main(int argc, char **argv)
>>{
>> printf("%s has %d arguments\n", *argv, argc);
>> exit(0);
>>}
>>
>>The compiler will give a warning that a function (main) which should
>>return an int does not return anything. ...
>>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?
But that is ugly. In most unix versions of lint at least you
can put: /*NOTREACHED*/ after exit() to mark that the program never get to
that point.
More information about the Comp.lang.c
mailing list