Community
Participate
Working Groups
For this code: int main() { } The parser gives the warning: No return, in function returning non-void The parser should make an exception for main(), as the standard explicitly allows main to return nothing (section 3.6.1/5), in which case the effect is the same as returning 0.
Created attachment 187023 [details] Fix Added the method isMain() to check if the function is main or not. If it is, a missing return value is not treated as a problem. Also added a junit test method testMainFunction() which tests a main function with no return value; it is expected to return no errors.
Personally I think people should just writer a better code by adding a return in main. Fixed anyway in cdt8 branch and head
I think many things too, but you can't satisfy everyone's opinions at the same time. That is why we have a standard :)