If a prototype for main() is neither according to the standard nor
supported by the implementation, I would expect a diagnostic message to
be printed instead of just silently allowing it and possibly invoke
undefined behaviour.
This is a dangerous expectation. The standard does not require a
diagnostic for this case. In fact, it doesn't require a diagnostic
for any specific case; what it requires is that, if a translation
unit has at least one constraint violation, the implementation must
emit at least one diagnostic (which might be "compilation finished",
say). But this isn't a constraint violation, so you don't even have
that guarantee.
The diagnostics provided by the implementation are purely a quality-
of-implementation issue, and many implementations are not of especially
high quality - including many of the most commonly used ones.
Moreover, there could be good reasons for an implementation to *not*
diagnose this. In particular, some implementations let you change the
parameters passed to main, and implement the parameterization of main
in a fashion sufficiently separate from the translator that the latter
does not know if you've changed it. (On some implementations, for
example, this would involve providing new "startup code".)
In short, it's better to know what the standard does and does not
require of an implementation, and what the implementation(s) you're
using documents as its implementation-defined behavior and extensions
to the language, than to hope that it will provide a diagnostic when
you violate the rules.
--
Michael Wojcik (e-mail address removed)
[After the lynching of George "Big Nose" Parrot, Dr. John] Osborne
had the skin tanned and made into a pair of shoes and a medical bag.
Osborne, who became governor, frequently wore the shoes.
-- _Lincoln [Nebraska] Journal Star_