On 2005-12-07, Default User wrote:
> Alf P. Steinbach wrote:
>
>> * anderberg:
>
>> > {
>> > Functor();
>> > return 0;
>>
>> Not necessary in 'main', because 'main' is a special function.
>
> While techinically true, it's not any kind of error to include the
> return. I always include it. If nothing else, it signals to the
> maintainer that the original programmer didn't just forget about the
> return, that 0 was indeed what was meant.
>
> Some compilers will flag it with a warning.
>
> Many common coding standards mandate the use of explict returns in
> main().
http://www.research.att.com/~bs/bs_faq2.html#void-main says
"Note also that neither ISO C++ nor C99 allows you to leave
the type out of a declaration. That is, in contrast to C89
and ARM C++ ,"int" is not assumed where a type is missing in a
declaration. Consequently:
#include<iostream>
main() { /* ... */ }
is an error because the return type of main() is missing."
--
anderberg: People are just mutations. Some worse than others.