|
From: James T. <jam...@kd...> - 2017-05-29 12:06:33
|
> On 29 May 2017, at 13:01, Edward d'Auvergne <tru...@gm...> wrote:
>
> Just a simple question, but should SGPropertyNode_ptr class members be
> initialised to null:
>
> Ephemeris::Ephemeris() : _impl(NULL), _latProp(NULL) {}
>
> I guess this protects the subsystem if the Ephemeris::init() function
> is not called.
No that’s automatic, that’s why smart pointers are better than dumb ones :)
(And they copy correctly, and clean themselves up correctly, and…)
And probably _impl should be a std::unique_ptr<SGEphemeris> and you won’t need the initialiser for that, or the delete / = NULL either.
Basically any new code, if you’re using a raw pointer, it had better not being an owning pointer, and even then, be careful :)
Kind regards,
James
|