← Back to team overview

kicad-developers team mailing list archive

Re: Bug fixing and Coverity scan errors.

 

Hi,

On 31.03.2015 13:29, Brian Sidebotham wrote:

>     delete m_model;

> should really be:

>     delete m_model;
>     m_model = NULL;

> Other functions (namely read_DEF) make assignment from m_model. It's
> too complicated to try and rely on knowing the logical order of
> functions in a file format parser to guarantee that it won't break. At
> least if the assignment from m_model assigns NULL, debugging is
> reasonably sane.

I'd rather like to see a smart pointer instead.

If my object deletes another object, this implies that it has a rough
idea of the ownership semantics, but these are never explicitly spelled
out. auto_ptr/unique_ptr could then be used to denote exclusive
ownership, shared_ptr for shared ownership, or intrusive_ptr for
reference counted objects with internal counters. Naked pointers could
then mean "no ownership".

   Simon

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References