Legal definitions of main() in C++14

后端 未结 2 923
执念已碎
执念已碎 2020-12-15 18:22

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

2条回答
  •  爱一瞬间的悲伤
    2020-12-15 18:48

    1. Is legal, the second and the latter aren't because of the following reasons:

    2. The return type of the main function cannot be deduced since CWG 1669 was accepted and the standard will be reworded as:

      An implementation shall not predefine the main function. This function shall not be overloaded. It shall have a declared return type of type int, but otherwise its type is implementation-defined.

      This got its way into n4140. More on this: http://wg21.cmeerw.net/cwg/issue1669

    3. The same as above

提交回复
热议问题