[vsipl++] [patch] Reduced profiler overhead for expressions

Mark Mitchell mark at codesourcery.com
Wed Aug 30 03:54:22 UTC 2006


Don McCoy wrote:

> +    if (event_)
> +      delete event_;

FYI, you're allowed to delete NULL.  The compiler is required to check 
that the pointer is non-NULL before passing it to operator delete.  So, 
The "if" is redundant.  A good compiler will of course optimize:

   if (x)
    if (x)
      f();

by removing one of the if-statements, so this is really just about not 
writing more code that you need to. :-)

-- 
Mark Mitchell
CodeSourcery
mark at codesourcery.com
(650) 331-3385 x713



More information about the vsipl++ mailing list