|
From: Edward d'A. <tru...@gm...> - 2017-05-29 17:24:39
|
On 29 May 2017 at 15:23, James Turner <jam...@kd...> wrote:
>
> On 29 May 2017, at 13:43, Edward d'Auvergne <tru...@gm...> wrote:
>
> Is this worth it for _impl if Ephemeris::data() is returning the raw
> pointer anyway (for example if modified to return _impl.get()?
>
>
> Yes, absolutely.
>
> This is not just about writing less code: when I see in the header, that
> Ephemeris has a std::unique_ptr<SGEphermeris>, that tells me the class owns
> the SGEphemeris object.
>
> With a raw-pointer, I have to always wonder if the pointer is owning or
> non-owning. And then when it’s wrong, we get bugs. 90% of the crashes in the
> AI and related code are because it’s unclear which pointers are owning and
> non-owning, and reference counting is not used.
Another dumb question, not having c++ training, but is this how you'd
eliminate all the raw pointers:
https://sourceforge.net/u/edauvergne/flightgear/ci/83057dc8f82fa45c32ab36fac28e46effa3266de/
I'll merge this myself if it's reasonable.
Cheers,
Edward
|