Now I know that X doesn't have a constructor, and it should. However until it DOES have a constructor, I have no way of initialising the member variable concerned, and I don't think you should warn about it.
I freely admit it is shocking bad that it doesn't have a constructor - the init() method is used to initialise it and that sets up everything fine. But I don't want to fiddle too much with code I don't really understand properly while introducing people to the joys of cppcheck. And cppcheck does provide a warning about classes with no constructors, so that whole thing can be dealt with then.
So I feel this is a bit of a false positive.
Thank you for listening.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For this code:
(which I admit is somewhat dubious), you get this
Now I know that X doesn't have a constructor, and it should. However until it DOES have a constructor, I have no way of initialising the member variable concerned, and I don't think you should warn about it.
I freely admit it is shocking bad that it doesn't have a constructor - the init() method is used to initialise it and that sets up everything fine. But I don't want to fiddle too much with code I don't really understand properly while introducing people to the joys of cppcheck. And cppcheck does provide a warning about classes with no constructors, so that whole thing can be dealt with then.
So I feel this is a bit of a false positive.
Thank you for listening.
and sorry for mistyping the title!
Did you forget to call
x.init();
?