3.1 KiB
[stmt.label]
8 Statements [stmt]
8.2 Label [stmt.label]
A label can be added to a statement or used anywhere in a compound-statement.
label:
attribute-specifier-seqopt identifier :
attribute-specifier-seqopt case constant-expression :
attribute-specifier-seqopt default :
labeled-statement:
label statement
The optional attribute-specifier-seq appertains to the label.
The only use of a label with an identifier is as the target of a goto.
No two labels in a function shall have the same identifier.
A label can be used in a goto statement before its introduction.
A labeled-statement whose label is a case or default label shall be enclosed by ([stmt.pre]) a switch statement ([stmt.switch]).
A control-flow-limited statement is a statement S for which:
a case or default label appearing within S shall be associated with a switch statement ([stmt.switch]) within S, and
a label declared in S shall only be referred to by a statement ([stmt.goto]) in S.
An identifier label shall not be enclosed by an expansion-statement ([stmt.expand]).