main() arguments, was Re: typedef-ing an array

Stephen Clamage steve at taumet.com
Sat Jul 7 03:39:32 AEST 1990


In article <4249 at jato.Jpl.Nasa.Gov> kaleb at mars.UUCP (Kaleb Keithley) writes:
>It also strikes me that what may be missing from the standard is a statement
>along the lines of "... use of exit() from main() is illegal..."

Such a statement is not only not missing, but the standard says the
opposite (section 2.1.2.2):

"A return from the initial call to the _main_ function is equivalent
to calling the _exit_ function with the value returned by the _main_
function as its argument."

Once again, the point of all of this is that the standard represents a
contract between the C compiler implementor and the C programmer.  The
implementor promises that the system will behave according to the standard
if the programmer writes code according to the standard.  The programmer
is free to write code some other way, but he cannot then expect his code
to work the same way when he tries it with some other compiler.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.lang.c mailing list