Mantis 1345
P1800-2008/D4
12.5, unique case
In
Section 12.5
CHANGE
In a unique-case, it shall be legal to
evaluate a case item expression at any time after the evaluation of the case
expression and before the evaluation of the corresponding comparison. A unique-case
shall be illegal if, for any such interleaving of evaluations and comparisons,
more than one case item matches the case expression. For an illegal
unique-case, an implementation shall be required to issue a warning message,
unless it can demonstrate a legal interleaving of evaluations and comparisons
so that no more than one case item matches the case expression. To implement
this requirement, an implementation can continue the evaluations and
comparisons after the termination of the usual linear search and before the
execution of the statement associated with the first matching case item.
However, the statements associated with any additional matching case items
shall not be executed.
TO (This will supercede the changes in
Mantis 1041 to this paragraph)
In a unique-case, it shall be
legal to evaluate a case item expression at any time after the evaluation of
the case expression and before the evaluation of the corresponding comparison.
A unique-case shall be illegal if, for any such interleaving of evaluations and
comparisons, more than one case item matches the case expression. For an
illegal unique-case, an implementation shall be required to issue a warning
message, unless it can demonstrate a legal interleaving of evaluations and
comparisons so that no more than one case item matches the case expression. To
implement this requirement, an implementation can continue the evaluations and
comparisons after the termination of the usual linear search and before the
execution of the statement associated with the first matching case item.
However, the statements associated with any additional matching case items
shall not be executed.
In a
unique-case, the case_expression shall be evaluated exactly once and before any of
the case_item
expressions. The case_item expressions may be evaluated in any order and compared in any
order. A unique-case is violated if more than one case_item
is found to match the case_expression and the
implementation shall issue a warning. The
implementation shall continue the evaluations and comparisons after finding the
first matching case_item and before the
execution of the statement associated with that case_item
but the statements associated with additional matching case_items
shall not be executed. After finding a uniqueness violation, the tool
implementation is not required to continue evaluating and comparing additional case_items. An implementation is not required to try
more than one order of evaluations and comparisons of case_item expressions. The presence
of side-effects in the case_item expressions may cause
non-deterministic results. It is not a violation of uniqueness for a single case_item to contain more than one case_item expression that matches the case_expression.
If a case_item expression matches the case_expression, the implementation is not required
to evaluate additional case_item expressions in the same case_item.