C99 5.1.2.2.3:
] 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.
Is the implicit "return 0;" guaranteed for all calls to main()? In
other words, can a recursive call to main() depend on the guarantee?
I think that the Standard guarantees it only for the initial call, but
not surely.
Thanks in advance.
--
Jun, Woong (myco...@hanmail.net)
Dept. of Physics, Univ. of Seoul
I believe that the qualifier "from the initial call to main" applies
only to the clause that preceeds the ';'. The clause after the ';'
applies to all calls to main(), not just the initial call.
No; that requirement is in a section headed "program termination" and
therefore only applies to the initial call to main.
All other calls are subject to the rule in 6.9.1:
[#12] If the } that terminates a function is reached, and
the value of the function call is used by the caller, the
behavior is undefined.
--
Clive D.W. Feather, writing for himself | Home: <cl...@davros.org>
Tel: +44 20 8371 1138 (work) | Web: <http://www.davros.org>
Fax: +44 870 051 9937 | Work: <cl...@demon.net>
Written on my laptop; please observe the Reply-To address