Weird linker warning -- never seen it.

Started by
10 comments, last by foniks munkee 19 years, 9 months ago
I'm positive. I was surprised when I read it, too, but I assume that Bjarne Stroustrup knows his stuff about C++. ;)
Advertisement
Yup that is true, return 0 is assumed. But using "void" in a function to denote an empty parameter list is not correct in C++. Again according to Bjarne and the standard.

[edit] Well - I hate it when I am wrong - Bjarne is definitely not keen on the use of void as an empty parameter list, however the standard has not problem with it:

Quote:
"The parameter list (void) is equivalent to the empty parameter list. Except for this special case, void shall not be a parameter type (though types derived from void, such as void* can)."


And the standard has this to say about main and return 0
Quote:
"A return statement in main has the effect of leaving the main function (destroying any objects with automatic storage duration) and calling exit with the return value as the argument. If control reaches the end of main without encountering a return statement, the effect is that of executing

return 0;"


Mmmm standard fresh...

[Edited by - foniks munkee on July 13, 2004 7:02:29 AM]

This topic is closed to new replies.

Advertisement