c++ - What was the rationale for making `return 0` at the end of `main` optional? -
starting c99 standard, compiler required generate equivalent of return 0
or return exit_success
if no return supplied @ end of main
. there corresponding , identical change c++ language standard around same time. interested in reasons both , guessed unlikely entirely separate , unrelated changes.
my question is:
what documented rationale change?
an ideal answer cite authoritative sources both c , c++ why have tagged question both languages.
note unlike question what reasons for/against returning 0 main in iso c++?, i'm not asking advice on whether write return 0
in programs -- i'm asking why language standards changed.
to understand purpose question, here bit more of context:
- understanding why change made helpful in deciding how use it.
- rationale included within standard itself. example, c90 standard includes many explanatory footnotes such footnote 36 starts, "the intent of list..."
i've studied standards searching answer myself before asked here, did not find answer. i've been asked write coding standards both languages group of programmers , wanted make sure understand why feature exists may accurately explain use others.
in the new c standard section 5.1.2.2.3 program termination author derek jones commentary on lines c99 standard:
reaching } terminates main function returns value of 0
is:
the standard having bow sloppy existing practices.
which indicates rationale address poor programming practices respect explicitly returning value main
. prior status returned undefined.
he indicates many implementations implemented in c90, fact change reflected common implementation helped.
Comments
Post a Comment