[Differential] [Request, 9 lines] D2080: do not 'default' handle switch-cases
sitter (Harald Sitter)
noreply at phabricator.kde.org
Mon Jul 4 09:38:51 UTC 2016
sitter created this revision.
sitter added a reviewer: sebas.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.
REVISION SUMMARY
using the default keyword hides compiler warnings. this causes enum
expansion to require a dev to remember to expand all switch-cases that use
the enum to make sure they are still correct, since that never ever happens
don't use default. also, why do what a computer can do for us...
drop default keyword usage. replace it with explicitly break cases, which
is explicitly overriding the compiler warning, and taking default actions
*after* the switch-case block.
this allows the compiler to warn about unhandled enum values. such as
> console.cpp:139:12: warning: enumeration value ‘DVI’ not handled in switch [-Wswitch]
REPOSITORY
rKSCREEN KScreen
BRANCH
Plasma/5.7
REVISION DETAIL
https://phabricator.kde.org/D2080
AFFECTED FILES
console/console.cpp
kded/generator.cpp
EMAIL PREFERENCES
https://phabricator.kde.org/settings/panel/emailpreferences/
To: sitter, sebas
Cc: plasma-devel, jensreuterberg, sebas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160704/ad8b3229/attachment-0001.html>
More information about the Plasma-devel
mailing list