do not 'default' handle switch-cases
ClosedPublic

Authored by sitter on Jul 4 2016, 9:38 AM.

Details

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]

Diff Detail

Repository
R104 KScreen
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
sitter updated this revision to Diff 4927.Jul 4 2016, 9:38 AM
sitter retitled this revision from to do not 'default' handle switch-cases.
sitter updated this object.
sitter edited the test plan for this revision. (Show Details)
sitter added a reviewer: sebas.
Restricted Application added a project: Plasma. · View Herald TranscriptJul 4 2016, 9:38 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sebas accepted this revision.Jul 4 2016, 11:23 AM
sebas edited edge metadata.

Nice improvement!

This revision is now accepted and ready to land.Jul 4 2016, 11:23 AM
This revision was automatically updated to reflect the committed changes.