[vtk-developers] vtkImageConvolve crashes when malloc fails

Sean McBride sean at rogue-research.com
Wed Jun 4 11:45:08 EDT 2008


On 6/4/08 10:37 AM, Amy Squillacote said:

>Actually, I think I was thinking of the "new" operator.

Ah, yes.  I'm not a language lawyer, but I believe the current C++
standard says that new _must_ throw an exception on failure, not return
null.  (At least by default, I think there is a 'nothrow' option.)  I
believe VS didn't/doesn't honour the standard here.

Another thing many people don't know is that it's perfectly ok to pass
null to delete.  So there is never a need to write:

if (anObject)
  delete anObject;

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtk-developers mailing list