Hi Peter,
I’m mostly having trouble with this:
Protocols/Gnutella/Packets/Testing/../BinaryReader.h:40: warning: base class ‘class Utils::Encodings::BinaryReader’ has a non-virtual destructor
./Utils/Uri.h:148: warning: base class ‘class QSharedData’ has a non-virtual destructor[snip]
I’ve read some mailing list discussions regarding which cases would be excluded from the effect of this warning, but the only “solution” that seems to work is declaring the dtor virtual. Maybe there is some workaround that I’m unaware of? Pragmas to disable warnings would be compiler specific. And we’d rather not use a workaround that does not produce better code. What do you think?
I don’t think there is an another workaround than declaring the dtor virtual either. I generally think that we could ignore warnings that comes from 3rd party classes (like Qt) which we can’t easily modify. However, as you wrote,
this warning could be useful with polymorphic hierarchies being used. But as BinaryReader is not intended to be used as a base class (with possibility to call a delete operator on the base pointer etc.), we don’t have to worry about it. Maybe we should create a list with warnings that are being “ignored” (resolved as non-problematic and hard/superfluous to fix)?
Btw as for the new Qt.h macros from rev. 135, what would you think about these changes?
#define REFERENCE_OBJECT(Class)
Class (const Class &);
Class & operator= (const Class &);
// Reference objects should be compared only as pointers, so disable comparison operators
bool operator== (const Class &);
bool operator!= (const Class &);
#define STATIC_HELPER(Class)
Class();
// Since there is no need to have these in the class (generated by compiler), disable them
~Class();
Class (const Class &);
Class & operator= (const Class &);
+ add some docs (I think that Doxygen has tags to document macros).
I’m looking forward to your post about ctors!
Have a nice day,
Petr
