A proposal to correct section 5.1.2.2.1.1 of the C standard

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.

Proposed new wording


5.1.2.2.1 Program startup

  1. 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.

5.1.2.2.3 Program termination

Delete final sentence.

Rationale

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

And since int is the only allowable return type, the final sentence of 5.1.2.2.3 is now unnecessary.


© Copyright 2002-2003 Jonathan de Boyne Pollard. "Moral" rights asserted.
Permission is hereby granted to copy and to distribute this web page in its original, unmodified form as long as its last modification datestamp information is preserved.