KPB said:
No. As others have said, the return statement is not needed.
Correct (this only applies to 'main()'
This was one of those weird facts that I didn't know about until
recently. I just include the return statement without thinking about it.
Actually, I and others feel that this constitutes 'good
practice' anyway. But it is incorrect to state that
omitting it is invalid.
I think I read this fact in one of the Josuttis books.
It's also cited in many others.
Also, I did try out the -Wall just to make sure.
That's the wrong way to determine how the language should
work.
To me, this is similar to the variable initialization issue. Some are
init'd implicitly (if you don't initialize them explicitly) and some
aren't. I just explicitly initialize everything then I don't have to
remember which are and which aren't.
Aa matter of 'habit', I will usually initialize every
object I define, regardless of its storage duration.
But the issue of which objects are automatically
initialized and which are not is straightforward:
1) Static storage duration objects are automatically default initialized.
2) Objects with any other storage duration are not automatically
initialized.
3) ("Special case") If one or more of an array's elements are explicitly
initialized, any elements for which there are no corresponding
initializers
are default inititalized.
-Mike