Some statements and expressions move the control flow out of the current code block. Additionally, some functions never return the control flow to
the caller. Any unlabeled statements that come after such a jump or function call is unreachable.
For instance, within a code block, code following a statement containing any of these keywords is effectively dead code:
-
return
-
break
-
continue
-
goto
-
co_return
-
throw
Examples of functions that never return the control flow to the caller:
-
exit()
-
abort()
-
std::terminate()
- Functions with the
[[noreturn]]
attribute.