[vtk-developers] vtkImageConvolve crashes when malloc fails
Francois Bertel
francois.bertel at kitware.com
Wed Jun 4 12:13:11 EDT 2008
In the standard, delete NULL is perfectly OK.
In reality, there is a gap between what the standard says and what
some compilers or some versions of some compilers support.
On Wed, Jun 4, 2008 at 11:45 AM, Sean McBride <sean at rogue-research.com> wrote:
> 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
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
--
François Bertel, PhD | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
| Clifton Park NY 12065, USA
More information about the vtk-developers
mailing list