On Thursday, 2 July 2015 01:39:44 UTC+1, Jeffrey Walton wrote:
>
>
>
> I believe what happened is constructors and destructors were sometimes not 
> written because the compiler will provide them. The "sometimes" appears to 
> be limited to stack based allocations (i.e., if 'new' was used to allocate 
> a member variable, then a virtual dtor was written).
>


That doesn't seem to be the case, because the warning means 'delete' is 
being used, so it's not a variable on the stack.


 

> However, the default destructor is not virtual in keeping with C/C++'s 
> "don't pay for it if you don't need it" mantra.
>
> Crypto++ has a mechanism to forgo vtables, but it was not applied to any 
> of the classes below. The mechanism is CRYPTOPP_NO_VTABLE.
>
> The patch below clears the warnings related to the library and the test 
> suite. There could be more places a virtual dtor is needed, but I don't 
> have test cases that highlights them.
>
> Is anyone opposed to the patch below? Or any other comments?
>
>

Another way to silence the warning is to tell the compiler that there are 
no derived classes, so it knows that the type being deleted is the 
most-derived type. That is done by marking the class as 'final' which is a 
C++11 feature, but GCC supports __final pre-C++11 so you could have a macro 
that expands to __final for GCC.

That will only work if you don't derive from those types being deleted. If 
that isn't always true then you definitely do want the virtual destructor.

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to