Warning about field initialization order, signed comparison and unused vars in VC ++ & Sun Studio

I hope to include warnings for the following C ++ compilations and related compilers:

  • Unused Variables - Sun Studio CC

    Example: void m() { int i = 10; }

  • Signed unsigned comparison - VC ++ and Sun Studio CC

    Example: if ((unsigned) 10 < -1);

  • Incorrect field initialization order - VC ++ and Sun Studio CC

    Example: class A { int i, j; A() : j(0), i(0) {} };

They are all caught by GCC, and I would like to include them 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: Regardless of the signed unsigned comparison warnings in VC ++, all other options do not seem possible.

+5
1

Visual Studio, Project Properties, ++, 4 () - V++ . AFAIK, 1 2, V++.

+2

All Articles