views:

962

answers:

2

Is there a gcc equivalent of VC++ warning C4018: signed/unsigned mismatch? We have an automated build on windows which runs with /WX and I'd like to be able to catch those warnings when building on Linux as well.

+7  A: 

-Wsign-compare

Unfortunately GCC warns in a lot of places where Visual Studio doesn't warn, so by enabling this warning I get a whole bunch of new warnings I have to fix.
JesperE
A: 

Best practice is to compile with -Wall it gives you most of warnings you need.

g++ -c -Wall code.cpp -o code.o

That what is done in most of projects and in fact it enables the warning you wanted.

Artyom
you forgot -Wextra -pedantic -Wshadow