← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Fix memory leaks with improper wxBaseConfig* usage (model ownership and ownership-transfer with std::unique_ptr)

 

Hi,

On 28.06.2016 21:30, Michael Steinberg wrote:

> Now I only need to know how I should go about your concerns. Maybe using
> something along the lines of
> 
>     using WX_CONFIG_PTR = std::unique_ptr< wxConfigBase >;

No, that isn't readable either, because it doesn't communicate the
semantics.

The full smart pointer template name is IMO the best choice here -- it
makes clear that the current context takes and keeps ownership of
whatever that function returns. It is not too ugly to read, and it makes
the intention clear.

"auto" is useful in places where the type does not matter, or cannot be
described, for example in a lambda, or when working with iterators:

auto less = [](int lhs, int rhs) -> bool { return lhs < rhs; };

auto i = mymap.find("foo");
if( i == mymap.end() ) ...

> A sidenote: if I find myself working on some parts of the code, are
> there objections if I silently add "override" specifiers in related
> code?

I have patches that add "virtual" and "override" to all overrides. So
far, these haven't been committed.

> I find these help a lot.

Indeed, especially "virtual".

   Simon

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References