D28324: [Inotify] Remove dead/duplicate code

Stefan BrĂ¼ns noreply at phabricator.kde.org
Fri Mar 27 18:02:38 GMT 2020


bruns marked an inline comment as done.
bruns added inline comments.

INLINE COMMENTS

> pino wrote in kinotify.cpp:350
> no, an assert is sort of "program by contract": you make it clear that this situation ought to not happen, and it if does, at least some people may notice that
> 
> > Anyone touching the code should and has to read the man pages etc anyway.
> 
> and an explicit mention/comment in the code never killed anyone, nor made the code "cluttered"; also what is valid today might change in the future, so writing down why a check/assert was added make sure that people reading the changed documentation know why it made sense when it was added

After two years of maintaining baloo (and other software for much longer) I can assure you you are wrong.

If we checked all the conditions which are guaranteed by the API (null termination of strings, only complete events, bounds check of event->len ...) here and everywhere else, the could would be cluttered. And just picking an arbitrary condition to be more equal is nonsense.

This is kernel API, it does not change.

Comments are useful when some code is not obvious. Copying an explicitly spelled out condition from the man page does clutter the code. Otherwise we would have to copy the whole man page to have the code covered in its entirety.

REPOSITORY
  R293 Baloo

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

To: bruns, #baloo, ngraham
Cc: pino, kde-frameworks-devel, hurikhan77, lots0logs, LeGast00n, cblack, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200327/c47eb107/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list