gcc (lack of) return type warnings

Tobias Pflug tobias.pflug@exorbyte.com
Wed Feb 14 14:16:00 GMT 2007


Hi,

I was lately having some issues with a cross platform project where
the code compiled fine with gcc and didn't under vc++. Turned out it had
to do with me forgetting a return statement in an int function.

I find it kind of weird that such misbehavior won't even reported as Warning
unless you compile with -Wall - Is that desired or could that be 
considered a bug?


int foo()
{

}

int main()
{
    int test = foo();
]

This will compile just fine. When compiled with -Wall it will at least
bring up a warning about the missing return statement in foo(), nothing
about main tho either. Or is there some standard that implicitly declares
main to return 0 when there is no explicit return statement?

regards,
Tobi



More information about the Gcc mailing list