As mentioned in a Frequently Given Answer, it is my opinion that the C standard contains a defect that should be fixed with a corrigendum. Here is my proposed rewording of section 5.1.2.2.1.1 to correct the defect.
The function called at program startup is named main
. The
implementation declares no prototype for this function. It shall be
defined with a return type of int
; and with no parameters:
int main(void) { /* ... */ }
or two parameters (referred to here as argc and argv, though any
names may be used, as they are local to the function in which they are
declared):
int main(int argc, char *argv[]) { /* ... */ }
or equivalent(8), or some other implementation-defined parameters.
Notice the placement of the semi-colon, the conjunctions, and the commas. The final sentence of 5.1.2.2.1 now parses as follows:
It shall be defined
- with a return type of
int
; and- with
- no parameters [...] or
- two parameters [...] or equivalent, or
- some other implementation-defined parameters.
And since int
is the only allowable return type, the final
sentence of 5.1.2.2.3 is now unnecessary.