Re: Is main a registered word



2006-12-08 <1165594037.776960.120100@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
santosh wrote:
Keith Thompson wrote:
Simias <fvzvnf.a@xxxxxxxxx> writes:
Thad Smith <ThadSmith@xxxxxxx> writes:
mark_bluemel@xxxxxxxxx wrote:
In C99, executing to the closing brace of main is the equivalent of
return 0.

Even if it's a recursive call to main?

I think so.

C99 5.1.2.2.3 says:

If the return type of the main function is a type compatible with
int, 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; reaching the } that terminates
the main function returns a value of 0.

The way it's phrased, I think the last clause refers to any call to
main, not just the initial call.

It seems to contradict the preceding statement. Anyhow, what if the
code returns a value other than zero, say EXIT_FAILURE?

Execution paths that reach a return statement will not reach the } that
terminates the function.
.



Relevant Pages

  • Re: Is main a registered word
    ... C99 5.1.2.2.3 says: ... the main function as its argument; reaching the} that terminates ... It seems to contradict the preceding statement. ... prototyped as returning an int value, but the code itself fails to ...
    (comp.lang.c)
  • Re: reply the answer
    ... The closest thing I can find is C99 6.9.1p12: ... If the} that terminates a function is reached, ... "Debugging is twice as hard as writing the code in the first place. ...
    (comp.lang.c)
  • Re: Abnormal Thread Termination
    ... some output which the executing thread is ... Rahul Anand ... Actually in managed code when ever thread abortion takes place then ... >> thread abnormally terminates when executing .NET method. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: preventing dos window close upon program termination
    ... for example: instead of executing "myExecutable.exe" ... The cmd shell will remain open after myExecutable terminates ... Bryan Phillips wrote: ...
    (microsoft.public.vsnet.debugging)
  • Re: function not returning a value
    ... Except that the C90 rule talks about ... something that's a constraint violation in C99. ... without executing a return statement; ... "Reaching the} that terminates a function is equivalent to ...
    (comp.lang.c)