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

后端 未结 9 1557
佛祖请我去吃肉
佛祖请我去吃肉 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:52

    Because some people don't know. Not necessarily the people who wrote that code (although that's also possible), but some people out there. Explicitly writing return 0; is being nice to them.

    Also, as a convention it makes the language more uniform, which aesthetically is important to at least me.

提交回复
热议问题