Hi, After spending the better part of the evening finding a bug caused by an uninitialized pointer I would love to get a Warning about uninitialized variables from g++ in cases like Foo, Bar and Baz below:
[EMAIL PROTECTED]:~% cat foo.cc class Foo { Foo() { } int *p; }; class Bar { Bar() { *p = 1; } int *p; }; class Baz { Baz() { } int get_p() { return *p; } int *p; }; [EMAIL PROTECTED]:~% g++ -g -O2 -W -Wall -Werror -Wuninitialized -c foo.cc [EMAIL PROTECTED]:~% g++ --version g++ (Debian 4.3.2-1) 4.3.2 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. In Foo the variable is just uninitialized, in Bar it is definetly used uninitialized and in Baz it might be used uninitialized. Is there any -W switch to make g++ detect such errors or is that a shortcomming of -Wuninitialized? MfG Goswin