Strange lint mumblings

James Logan III logan at vsedev.VSE.COM
Sat Dec 17 11:45:19 AEST 1988


In article <416 at marob.MASA.COM> daveh at marob.masa.com (Dave Hammond) writes:
# Can anyone explain why the statement:
# 
#     exit(0);	/* followed immediately by main's closing brace */
# 
# causes lint to complain:
# 
# ma-main.c
# ==============
# (137)  warning: main() returns random value to invocation environment

Lint does not realize that exit() does not return control back to
the function main().  Since you don't have "return <value>" as
the last statement, Lint thinks the return value of main() would be
undefined.

If you want lint to stop whining about it, change the last few
lines to:      

	exit(0);
	/*NOTREACHED*/
}

Don't ask me to give you a good reason for why lint doesn't know
about exit(); there is none.   

			-Jim

-- 
Jim Logan		logan at vsedev.vse.com
(703) 892-0002		uucp:	..!uunet!vsedev!logan
			inet:	logan%vsedev.vse.com at uunet.uu.net



More information about the Comp.lang.c mailing list