D24372: Compile without deprecated foreach

Ahmad Samir noreply at phabricator.kde.org
Wed Oct 9 00:59:29 BST 2019


ahmadsamir added inline comments.

INLINE COMMENTS

> dfaure wrote in job.cpp:181
> You need a local const var to hold the result of the subjobs() method call.
> 
> (repeats)

IIUC, subjobs() returns a const QList &, do we still need a local const var?
https://api.kde.org/frameworks/kcoreaddons/html/classKCompositeJob.html#aaec8d9b05c7c4194c5ba121d43f2997e

> dfaure wrote in ktcpsocket.cpp:729
> or just iterate over `ciphers`, which is already const

Yep.

> dfaure wrote in scheduler.cpp:214
> qAsConst not needed, this method is const

(... and m_runningJobs is a member var).

> dfaure wrote in scheduler.cpp:377
> Did you try enabling this to make sure your ported code compiles?

Yes, I did. (I, like everyone else, hate to be embarrassed, so I always make sure it builds and passes unittests whenever I change anything except maybe comments :)).

> dfaure wrote in dropjob.cpp:270
> qAsConst

m_urls is declared const in DropJobPrivate: https://cgit.kde.org/kio.git/tree/src/widgets/dropjob.cpp#n142

> dfaure wrote in kfileitemdelegate.cpp:233
> not needed, method is const and informationList is a member

"member" is what made that concept finally click in my head; (I kept thinking calling begin() on a qt container won't call the const overload, but it will if the container is a member and the this pointer is a pointer to const).

REPOSITORY
  R241 KIO

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

To: ahmadsamir, dfaure
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191008/545e0160/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list