What the reasons for/against returning 0 from main in ISO C++?

后端 未结 9 1633
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-20 19:12

I know that the C++ standard says that return 0 is inserted at the end of main() if no return statement is given; however, I often see recently-wri

9条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-20 19:46

    Just because your code complies with the standard, who says your code is going to be run through a compliant compiler? Believe it or not, people do use compilers besides just recent versions of GCC and Visual C++.

    And of course there's the explicit intent thing that everyone else has mentioned.

提交回复
热议问题