Nick Keighley said:
On 12 Apr, 14:07, J de Boyne Pollard <
[email protected]>
wrote: [...]
Actually, there is. Â You've stopped reading one third of
the way through a sentence.
continuing
"or with two parameters (refered to here as argc and argv [...])"
no I'm sorry I'm not going to type the whole bloody spec in. There is
nothing in the remainder of the sentence that mentions return types.
[snip]
Yes, there's an ambiguity there. It says, in outline that main()
shall be defined with a return type of int and with no parameters ...
or with two parameters [argc and argv] or equivalent; or in some other
implementation-defined manner.
The question is, what is the scope of the "or"? It's usually
assumed that it means
with a return type of int
and
with no parameters
or
with two parameters
or
in some other implementation-defined manner
But the wording and punctuation could easily imply:
with a return type of int
and
with no parameters
or
with two parameters
or
in some other implementation-defined manner
which requires any implementation-defined manner to have a return type
of int.
But if you read on to 5.1.2.2.3p1, you'll see:
If the return type is not compatible with int, the termination
status returned to the host environment is unspecified.
Under the second interpretation, that would be as meaningless.
I think that makes it sufficiently clear that the authors of the
standard intended "some other implementation-defined manner" to
permit return types other than int.