Warning when C ++ global variables are not explicitly initialized?

Let's say I have a global variable (or namespace):

int *Pointer;

      

It is of course zero, initialized, but is there a way in Clang (or with Clang's static analysis tools) to warn about Pointer

that has not been explicitly initialized? I searched and couldn't find anything.

+3


source to share


1 answer


According to the standard, there is no reason to warn about implicit initialization, it is no different from explicit. If you are a good enough derivative, you can replace traditional types with templates that will warn you about this. But that defeats the goal of being lazy, right?



Or better yet, don't use naked pointers, pornography anti-aliasing isn't cool.

+2


source







All Articles