[Insight-developers] CPPCheck Suggested Changes?
Bradley Lowekamp
blowekamp at mail.nih.gov
Thu Sep 3 17:26:04 EDT 2009
On Sep 3, 2009, at 5:13 PM, kent williams wrote:
>
> I have a question about one of the most common suggestions: Since
> delete 0
> and delete [] 0 are legal and harmless, it recommends not checking
> for 0
> before deleting. This happens so frequently in the ITK library, it
> looks as
> though it was done on purpose. Should I take those out, e.g.
>
I did not know this myself! Do we know if this is portable?
Ideally I would think that some of those deletes, should use
AutoPointers instead of raw pointers, so that it would deal easily
with exceptions. But there is likely many complex cases making this
perhaps more difficult, then just your proposed change.
Brad
> if(this->m_Something)
> {
> delete this->m_Something;
> }
>
> becomes simply
>
> delete this->m_Something;
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090903/74e72270/attachment.htm>
More information about the Insight-developers
mailing list