CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 52

Threaded View

  1. #23
    Join Date
    May 2009
    Posts
    2,413

    Re: Interview Questions

    Quote Originally Posted by D_Drmmr View Post
    If every class should/must have a virtual destructor, you don't have the option of using the compiler implementation.
    Your example didn't back up the claims you've made about the inefficiency of virtual destructors. I think you should acknowledge that.

    You relied on a compiler dependent optimization. This backfired. The C++ standard doesn't state compiler generated destructors must be faster than user supplied empty ones. So generally it's a bad idea to bet on this for the performance of a program. And it's even worse to recommend others to do it.

    It's called premature optimization. In my view many C++ programmers spend too much time fiddling with implementation detail they don't know will have any impact on the overall application performance. If you have this inclination it's better to use C. Far less abstraction and much more sweating the small stuff.
    Last edited by nuzzle; August 18th, 2012 at 05:27 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured