expression-statement: expressionopt ;
1721 The expression in an expression statement is evaluated as a void expression for its side effects.132)
1722 A null statement (consisting of just a semicolon) performs no operations.
1723 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the discarding of its value may be made explicit by converting the expression to a void expression by means of a cast:
int p(int);
/* ... */
(void)p(0);
1724 132) Such as assignments, and function calls which have side effects.
1725 EXAMPLE 2 In the program fragment
char *s;
/* ... */
while (*s++ != '\0')
;
a null statement is used to supply an empty loop body to the iteration statement.
1726
EXAMPLE 3
A null statement may also be used to carry a label just before the
closing
while (loop1) {
/* ... */
while (loop2) {
/* ... */
if (want_out)
goto end_loop1;
/* ... */
}
/* ... */
end_loop1: ;
}
1727 Forward references: iteration statements (6.8.5).
Next
Created at: 2005-06-29 02:19:03
The text from WG14/N1124 is copyright © ISO