-Wswitch-enum and -Wswitch-default

2007-03-30 Thread Ching, Jimen \(US SSA\)
Hi, I'm using g++ 4.1.1 under Fedora Core 5 in an X86 system. I read the GCC manual and it says -Wall includes the -Wswitch-enum and -Wswitch-default warnings. But I had to supply these command line options explicitly before the warnings are generated. Is the manual wrong or is there a bug in g

RE: -Wswitch-enum and -Wswitch-default

2007-04-02 Thread Ching, Jimen \(US SSA\)
> Therefore, only -Wswitch is enabled by -Wall but neither of > Wswitch-default or Wswitch-enum are. The statement for -Wall says: -Wall All of the above `-W' options combined. This enables all the warnings about constructions that some users consider questionable, and that are easy to avoi

-Wextra and enumerator/non-enumerator in conditional expressions

2007-04-04 Thread Ching, Jimen \(US SSA\)
Hi all, I'm using g++ 4.1.1 under Fedora Core 5 on an Intel system. I'm compiling the following code with "g++ -Wextra tst.cpp". enum my_enum { FOO = 10, BAR, BAZ }; int main() { my_enum e = BAR; while (e == 15); for (;e == 15;);

Always generate warning/error for assignment as truth value

2007-05-02 Thread Ching, Jimen \(US SSA\)
Hi, I was wondering if there's an option to gcc/g++ to make it generate a warning/error when an assignment is used as a truth value in an expression. The -Wall option does this. But it can be silenced with parentheses. The problem is, macros often use parentheses around expressions. Thus, this w

namespace lookup

2007-05-24 Thread Ching, Jimen \(US SSA\)
Hi, I have the following code: namespace X { namespace Y { namespace Z { struct A { typedef int int_t; }; struct Z { typedef int int_t; }; } } } using namespace X::Y::Z; int main() { Z::A::int_t i = 0; Z::Z::int_t j = 0; return i == j; } I used the comma

RE: namespace lookup

2007-05-24 Thread Ching, Jimen \(US SSA\)
> > namespace X > > { > > namespace Y > > { > > namespace Z > > { > > struct A { typedef int int_t; }; > > struct Z { typedef int int_t; }; } } } > > > > using namespace X::Y::Z; > > > > int > > main() > > { > > Z::A::int_t i = 0; > > Z::Z::int_t j = 0; > > r