D16556: Modernize object declarations and initializations
Denis Kurz
noreply at phabricator.kde.org
Thu Nov 1 13:49:57 GMT 2018
dkurz added inline comments.
INLINE COMMENTS
> dvratil wrote in entitytreemodeltest.cpp:131
> <rant>I'm starting to dislike the `QObject`'s "parent" more and more...here `this` becomes the owner of the object, yet semantically the ownership should be in `FakeServerData`. The `const`ness that you added here makes it even more confusing, as it hides the fact that there's ownership transfer...ideally this would be a `std::unique_ptr` that would be `std::move()`d into `FakeServerData`, clearly expressing the ownership and its transfer.</rant>
>
> (You don't have to change this, fixing ownership expression in the codebase is way out-of-scope, especially for tests)
I completely agree with your rant. I read a lot about modern C++ before turning to KDE, and Qt's understanding of ownership prevents you from doing anything that is taught today on that matter, especially about using the type system to express ownership.
(Awright, I won't)
> dvratil wrote in entitytreemodeltest.cpp:179
> You should use the uniform initialization...uniformly :-) So everywhere, or nowhere (except where required to solve most vexing parse - preferred), just don't use it randomly, please.
My intent was to replace `()` with uniform initialization whereever I touch code. If I got you right, you'd prefer the opposite, using parens where possible, so I would now change back all those braces. Feel free to stop me if I misunderstood to spare me some time.
REPOSITORY
R165 Akonadi
REVISION DETAIL
https://phabricator.kde.org/D16556
To: dkurz, #kde_pim, dvratil
Cc: dvratil, kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20181101/c66fbf67/attachment.html>
More information about the kde-pim
mailing list