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:

  1. understanding why change made helpful in deciding how use it.
  2. 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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -