kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #17686
Re: Bug fixing and Coverity scan errors.
On 3/31/2015 4:03 PM, Simon Richter wrote:
> 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
This is my preference as well. Although I would veto unique_ptr for
now. I'm not ready to make kicad c++ 0x11 compliant yet.
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References