On Fri, 18 Aug 2000, Baruch Even wrote:
> Just got this from the cpptips mailing list of Allan Clarke, this might be
> usefull as an ass keeper for all those uninitialized pointers in our code.
>
> What do you say about adding it to the src/support ?
If I remember correctly, you can ask gcc to warn you about uninitialized
member variables in classes. It might be in connection with the -Weffc++
flag.
That, I think, is a better solution since it does not increase compile
time, does not introduce any runtime overhead, and does not introduce a
new class for everybody to learn and understand.
Of course, it will not detect uninitialized global variables, but you
would never use such, would you? If you do, please incapsulate it into a
singleton class instead so that it is easy to spot and such that we can
control lifetime better, in addition to getting the warning.
Greets,
Asger