kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #25248
Re: [PATCH] Fix memory leaks with improper wxBaseConfig* usage (model ownership and ownership-transfer with std::unique_ptr)
On 6/28/2016 3:55 PM, Simon Richter wrote:
> 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.
This is my preference.
>
> "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.
They are on my todo list but if I could get some help with testing on
different compilers (preferably older gcc 4.8ish compilers which are
still in use in a lot of stable environments) and different platforms,
that would be helpful.
>
>> I find these help a lot.
>
> Indeed, especially "virtual".
>
> Simon
>
>
>
> _______________________________________________
> 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
>
References