Hello, I'd like to know whether g++ can detect a member variable which is not initialized (on purpose) by the constructor.
Easier with a simple example (the class is supposed to be a fixed point variable): class A { private: int my_value; A (int init) { my_value = init; } public: A () {} A (const A& init) { my_value = init.my_value; } A& operator = (int scalar) { my_value = scalar << 8; } ... }; int main (void) { int p, q; A x, y; p = q; y = x; } g++ complains about q beeing used but not initialized, is there a way for it to complain about x too ? I tried the options -O -Wall -Wextra. (yes I could put 0 in the constructor, but code size is critical in the embedded environment I use, and I'm curious too :-) I also tried "A () const {}" but it is refused. I know from comp.lang.c++ that this is not a c++standard request to do so, but there are always some interesting stuff in gcc that I don't know :-) Thanks for any information, david _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus