hustoj icon indicating copy to clipboard operation
hustoj copied to clipboard

C++ main函数没有 return 0; 不报错

Open youyu opened this issue 4 years ago • 1 comments

C++ main函数没有 return 0; 不报错;不利于培养学生严格的答题习惯,竞赛中是明确要求要的。请问怎么修改?

youyu avatar Jan 22 '21 02:01 youyu

"如果main函数的末尾没写return语句,C++98 规定编译器要自动在生成的目标文件中加入 return 0;"

出处请百度这句话。

理论上如果你一定要它出错,需要去把系统的gcc给降级到c++98之前的版本和标准。

zhblue avatar Jan 22 '21 12:01 zhblue