[Insight-developers] CPPCheck Suggested Changes?
kent williams
norman-k-williams at uiowa.edu
Thu Sep 3 17:37:10 EDT 2009
the oldest and crappiest would be visual studio 6 and borland C++. Do they
do something dumb when asked to delete 0?
On 9/3/09 4:26 PM, "Sean McBride" <sean at rogue-research.com> wrote:
> On 9/3/09 4:13 PM, kent williams said:
>
>> Since delete 0
>> and delete [] 0 are legal and harmless
>
> True.
>
>> it recommends not checking for 0
>> before deleting.
>
> I would agree.
>
>> This happens so frequently in the ITK library, it looks as
>> though it was done on purpose. Should I take those out, e.g.
>>
>> if(this->m_Something)
>> {
>> delete this->m_Something;
>> }
>>
>> becomes simply
>>
>> delete this->m_Something;
>
> IIRC, some crappy old compilers do not properly handle delete 0. So it
> probably is deliberate.
>
> --
> ____________________________________________________________
> 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 Insight-developers
mailing list