What was Wrong with void main()?

前端 未结 4 815
鱼传尺愫
鱼传尺愫 2021-01-01 16:02

Why has setting the entry point\'s return type to void in C++ always been discouraged, and was later removed by the standard and is prohibited by modern compile

4条回答
  •  情书的邮戳
    2021-01-01 16:55

    It's wrong because this is not what the C++ Standard specifies as a legal main. Nobody cares about what the other languages specify. For C++ programs, only the C++ Standard is relevant, and it says int.

提交回复
热议问题