google / google/styleguide

C++ style guide: rule for default case

Open
#406 1 comment 0 reactions 0 assignees View on GitHub
lang:cpp
Dominant language
HTML
Stars
39.6k
Forks
12.9k
Avg merge
42m
Merged PRs (30d)
15

Description

> If not conditional on an enumerated value, switch statements should always have a `default case` (in the case of an enumerated value, the compiler will warn you if any values are not handled). If the default case should never execute, treat this as an error. For example:

This rule for `default case` in [Loops and Switch Statements](https://google.github.io/styleguide/cppguide.html#Loops_and_Switch_Statements) seems not like a [`Formatting`](https://google.github.io/styleguide/cppguide.html#Formatting) issue, how about shift it to some other place?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.