mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Fix #1004
This commit is contained in:
parent
4bbcd758f2
commit
79dd574a65
|
@ -12191,8 +12191,9 @@ If you really need to break out a loop, a `break` is typically better than alter
|
||||||
break;
|
break;
|
||||||
case Warning:
|
case Warning:
|
||||||
write_event_log();
|
write_event_log();
|
||||||
|
// Bad - implicit fallthrough
|
||||||
case Error:
|
case Error:
|
||||||
display_error_window(); // Bad
|
display_error_window();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12206,7 +12207,7 @@ It is easy to overlook the fallthrough. Be explicit:
|
||||||
write_event_log();
|
write_event_log();
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case Error:
|
case Error:
|
||||||
display_error_window(); // Bad
|
display_error_window();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12220,7 +12221,7 @@ In C++17, use a `[[fallthrough]]` annotation:
|
||||||
write_event_log();
|
write_event_log();
|
||||||
[[fallthrough]]; // C++17
|
[[fallthrough]]; // C++17
|
||||||
case Error:
|
case Error:
|
||||||
display_error_window(); // Bad
|
display_error_window();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user