Why, if the c++ standard says that the syntax is incorrect, does g++ allow it? -


I have just read a comment with something that has been said with its preference:

"Never You should always use int main () .

I now use int main () I know the reasons for using (so that you can check the success on return and watts) but I did not know that zero main () was invalid and I did some investigation and for only one reason Send me the void main () It is not used because "standard is so called"

My question is, if the C ++ standard says that the main has to return a value, then what is the G + + programmer with the Allows void main () to be used as a valid syntax? Will not return an error / warning because it goes against the standard?

This means only a special version of your compiler can allow it , But the latter version (which is likely to be a more standard conditioner) can not allow it. Write a standard confirmation code from better start!

Comments