I am hoping to enable warnings for the following C++ compilation issues and corresponding compilers:
Unused variables -- Sun Studio CC
Example: void m() { int i = 10; }
Signed to unsigned comparison - VC++ and Sun Studio CC
Example: if ((unsigned) 10 < -1);
Wrong field initialization order - VC++ and Sun Studio CC
Example: class A { int i, j; A() : j(0), i(0) {} };
All of these are caught by GCC and I would like to enable these in VC++ and Sun Studio.
bash-4.1$ g++ -Wall main.cpp
main.cpp: In function ‘void m()’:
main.cpp:1: warning: comparison between signed and unsigned integer expressions
main.cpp:1: warning: unused variable ‘i’
main.cpp: In constructor ‘A::A()’:
main.cpp:1: warning: ‘A::j’ will be initialized after
main.cpp:1: warning: ‘int A::i’
main.cpp:1: warning: when initialized here
EDIT: Outside enabling signed to unsigned comparison warnings on VC++, all other options do not seem to be possible.
In Visual Studio, Project Properties, C++, set warning level to 4 (maximum) - VC++ compiler gives all possible warnings. AFAIK, warnings 1 and 2 are reported, and field initialization order is not reported by VC++ compiler.