X hits on this document

1070 views

0 shares

0 downloads

0 comments

186 / 396

Chapter ‎18   Unsafe code

The switch expression is a non-constant value.

The switch expression is a constant value that matches a case label in the switch section.

The switch expression is a constant value that doesn’t match any case label, and the switch section contains the default label.

A switch label of the switch section is referenced by a reachable goto case or goto default statement.

The end point of a switch statement is reachable if at least one of the following is true:

The switch statement contains a reachable break statement that exits the switch statement.

The switch statement is reachable, the switch expression is a non-constant value, and no default label is present.

The switch statement is reachable, the switch expression is a constant value that doesn’t match any case label, and no default label is present.

8.8 Iteration statements

Iteration statements repeatedly execute an embedded statement.

iteration-statement: while-statement do-statement for-statement foreach-statement

8.8.1 The while statement

The while statement conditionally executes an embedded statement zero or more times.

while-statement: while   (   boolean-expression   )   embedded-statement

A while statement is executed as follows:

The boolean-expression (§‎7.16) is evaluated.

If the boolean expression yields true, control is transferred to the embedded statement. When and if control reaches the end point of the embedded statement (possibly from execution of a continue statement), control is transferred to the beginning of the while statement.

If the boolean expression yields false, control is transferred to the end point of the while statement.

Within the embedded statement of a while statement, a break statement (§‎8.9.1) may be used to transfer control to the end point of the while statement (thus ending iteration of the embedded statement), and a continue statement (§‎8.9.2) may be used to transfer control to the end point of the embedded statement (thus performing another iteration of the while statement).

The embedded statement of a while statement is reachable if the while statement is reachable and the boolean expression does not have the constant value false.

The end point of a while statement is reachable if at least one of the following is true:

The while statement contains a reachable break statement that exits the while statement.

The while statement is reachable and the boolean expression does not have the constant value true.

8.8.2 The do statement

The do statement conditionally executes an embedded statement one or more times.

Copyright Microsoft Corporation 1999-2003. All Rights Reserved.173

Document info
Document views1070
Page views1070
Page last viewedSat Dec 10 21:06:05 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments