D16484: Add scratchpad plugin

Kevin Funk noreply at phabricator.kde.org
Mon Dec 10 08:45:06 GMT 2018


kfunk added inline comments.

INLINE COMMENTS

> amhndu wrote in scratchpad.cpp:136
> From what I understand reading https://isocpp.org/wiki/faq/const-correctness#return-const-ref-from-const-memfn, returning a non-const ref from a const member function is not recommended.
> Sorry, I didn't mean to argue but I'm trying to learn in the process.

Hey Amhndu.

Sorry for replying late, but I've been busy last week.

I agree that the source you're citing very much is in contrast to what I was saying. I'm trying to keep this short, but in the Qt world a `const` method implies that the function call has *no side-effects*. Here we're giving out a non-const pointer to an internal implementation detail (which the caller can then freely modify), but that is of no concern to us. We're only concerned about whether `this` is modified by that function call.

Maybe the best explanation you can find is this one here: https://wiki.qt.io/API_Design_Principles#Constness (see section "Return values: pointers vs. const pointers")

REPOSITORY
  R32 KDevelop

BRANCH
  scratchpad

REVISION DETAIL
  https://phabricator.kde.org/D16484

To: amhndu, #kdevelop, kfunk
Cc: kfunk, gregormi, brauch, kdevelop-devel, glebaccon, hase, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20181210/e022baf6/attachment.html>


More information about the KDevelop-devel mailing list