Strange lint mumblings

Richard A. O'Keefe ok at quintus.uucp
Fri Dec 16 10:52:45 AEST 1988

In article <1037 at alobar.ATT.COM> grs at alobar.ATT.COM (Gregg Siegfried) writes:
>In article <416 at marob.MASA.COM> daveh at (Dave Hammond) writes:
>>Can anyone explain why the statement:
>>    exit(0);	/* followed immediately by main's closing brace */
>>causes lint to complain:
>>(137)  warning: main() returns random value to invocation environment

Note that exit() can be called *anywhere*, not just in main().
In particular, it can legitimately be called in functions which do NOT
return 'int' (e.g. many of my report-error-and-drop-dead functions are
declared 'void'), so the "return exit(0)" kludge that two posters have
suggested so far really isn't a very good idea.

If you read the lint documentation you will find that it understands some
special comments.  In particular, the way to handle things like exit()
and longjmp() is
which is reasonably clear to human readers as well.

More information about the Comp.lang.c mailing list