Previous Table of Contents "New C Standard" commentary
expression-statement: expressionopt ;
1732 The expression in an expression statement is evaluated as a void expression for its side effects.132)
1733 A null statement (consisting of just a semicolon) performs no operations.
1734 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);
1735 132) Such as assignments, and function calls which have side effects.
1736 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.
1737
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: ;
}
1738 Forward references: iteration statements (6.8.5).
Next
Created at: 2008-01-30 02:39:44
The text from WG14/N1256 is copyright © ISO