Use explicit flag values or explicit constructor instead of nullptr
ClosedPublic

Authored by kossebau on May 31 2017, 1:13 PM.

Details

Summary

The constructor of QFlags which was intended to handle literal "0"
as commonly used indicator of no-flags-set has been done with a
trick based on pointer types. Which these days of nullptr existing and
compilers pushing to use that sadly fired back and, instead of
allowing convenient code with commonly understood literal "0" values,
resulted in quite some code using "nullptr" to indicate a QFLags-based
type value with no flags set, which can be puzzling for humans
reading the code

To improve the code again IMHO, instead of "nullptr" are used:

  • enum item representing the 0=no-flag-set value, if existing
  • explicit constructor (or {} for default arg values, given arg type is aöready noted as part of arg definition)

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.May 31 2017, 1:13 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptMay 31 2017, 1:13 PM
kfunk accepted this revision.May 31 2017, 1:15 PM
This revision is now accepted and ready to land.May 31 2017, 1:15 PM
This revision was automatically updated to reflect the committed changes.