[Home] [Prev] [Next] [Index]

10.6 Program Optimization

10.6 Program Optimization

1
Optimization of the elaboration of declarations and the execution of statements may be performed by compilers. In particular, a compiler may be able to optimize a program by evaluating certain expressions, in addition to those that are static expressions. Should one of these expressions, whether static or not, be such that an exception would be raised by its evaluation, then the code in that path of the program can be replaced by code to raise the exception; the same holds for exceptions raised by the evaluation of names and simple expressions. (See also section 11.6.)

2
A compiler may find that some statements or subprograms will never be executed, for example, if their execution depends on a condition known to be FALSE. The corresponding object machine code can then be omitted. This rule permits the effect of conditional compilation within the language.

Note:

3
An expression whose evaluation is known to raise an exception need not represent an error if it occurs in a statement or subprogram that is never executed. The compiler may warn the programmer of a potential error.

4
References:

*
condition 5.3

*
declaration 3.1

*
elaboration 3.9

*
evaluation 4.5

*
exception 11

*
expression 4.4

*
false boolean value 3.5.3

*
program 10

*
raising of exceptions 11.3

*
statement 5

*
static expression 4.9

*
subprogram 6



[Home] [Prev] [Next] [Index]

documentation@rational.com
Copyright © 1993-2000, Rational Software Corporation. All rights reserved.