The last draft of C++14 that I was able to find says, regarding main()
[3.6.1]:
An implementation shall not predefine the main function. This function shall not be overloaded. It shall have a return type of type int, but otherwise its type is implementation-defined. All implementations shall allow both
— a function of () returning int and
— a function of (int, pointer to pointer to char) returning int
and (paragraph 5)
If control reaches the end of main without encountering a return statement, the effect is that of executing
return 0;
Does this mean that all of the following are legal C++14 minimal programs? If any isn't, why not?
auto main() -> int {}
auto main() { return 0; }
auto main() {}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…