-Wall option less picky in c++ than in c?

I'm somewhat dangerous in C, not an expert by any means. I decided to rip off the bandaid and learn c++ as I want to use the Qt libraries. So I've been going thru and messing with the tutorials here which are really nice.

gcc -Wall has really helped me a lot in the past... but I noticed I just wasn't I'm not getting many warnings I to use it with g++, so I tried:

given code in file testwall.c:

1
2
3
int main(int argc, char **argv)
{
}


gcc -Wall testwall.c gives a: warning: control reaches end of non-void function [-Wreturn-type]

g++ -Wall says nothing at all about this.

Is there a way to ask for maximum warning level that I should know about?



g++ -Wall says nothing at all about this.
In C++ main has an implicit return 0 at the end, so in C++ it is legal (unlike C) and not require diagnostic.

-Wall do not shows all warnings. At least add -Wextra and -pedantic. Or:
http://stackoverflow.com/questions/399850/best-compiler-warning-level-for-c-c-compilers
> In C++ main has an implicit return 0 at the end, so in C++ it is legal (unlike C) and not require diagnostic.

The implicit return 0 for main() is there in standard C too.
http://coliru.stacked-crooked.com/a/5e4b1cf8948a7208
Oh, cool. Guess you just need to turn on C99 (or C11) to get rid of the warning then.
Yes. C89 did not have this provision.

In any case, unless both -std=<some actual standard> and -pedantic-errors are present, GNU compilers assume that the code is in some non-standard GNU dialect.
Topic archived. No new replies allowed.