3.5 Declarations  -< ANSI C Rationale  -> 3.7 External Definitions             Index 

3.6  Statements

3.6.1  Labeled statements

Since label definition and label reference are syntactically distinctive contexts, labels are established as a separate name space. 

3.6.2  Compound statement, or block

The Committee considered proposals for forbidding a goto into a block from outside, since such a restriction would make possible much easier flow optimization and would avoid the whole issue of initializing auto storage (see §3.1.2.4).  The Committee rejected such a ban out of fear of invalidating working code (however undisciplined)  and out of concern for those producing machine-generated C.

3.6.3  Expression and null statements

The void cast is not needed in an expression statement, since any value is always discarded.  Some checking compilers prefer this reassurance, however, for functions that return objects of types other than void

3.6.4  Selection statements

3.6.4.1  The if statement

See §3.6.2

3.6.4.2  The switch statement

The controlling expression of a switch statement may now have any integral type, even unsigned long Floating types were rejected for switch statements since exact equality in floating point is not portable. 

case labels are first converted to the type of the controlling expression of the switch, then checked for equality with other labels; no two may match after conversion. 

Case ranges (of the form lo .. hi were seriously considered, but ultimately not adopted in the Standard on the grounds that it added no new capability, just a problematic coding convenience.  The construct seems to promise more than it could be mandated to deliver:

No serious consideration was given to making the switch more structured, as in Pascal, out of fear of invalidating working code. 

3.6.5  Iteration statements

3.6.5.1  The while statement

3.6.5.2  The do statement

3.6.5.3  The for statement

3.6.6  Jump statements

3.6.6.1  The goto statement

See §3.6.2

3.6.6.2  The continue statement

The Committee rejected proposed enhancements to continue and break which would allow specification of an iteration statement other than the immediately enclosing one, on grounds of insufficient prior art. 

3.6.6.3  The break statement

See §3.6.6.2

3.6.6.4  The return statement


3.5 Declarations  -< ANSI C Rationale  -> 3.7 External Definitions             Index