HP C Programmer's Guide (92434-90009)

78 Chapter4
Optimizing HP C Programs
Controlling Specific Optimizer Features
When +Onoprocelim is specified, procedures that are not referenced by the application are
not eliminated from the output executable file.
The default is +Onoprocelim at levels 0-3, and +Oprocelim at level 4.
If the +Oall option is enabled, the +Oprocelim option is enabled.
+O[no]ptrs_ansi
Optimization level(s): 2, 3, 4
Default: +Onoptrs_ansi
Use +Optrs_ansi to make the following two assumptions, which the more aggressive
+Optrs_strongly_typed does not make:
•Anint *p is assumed to point to an int field of a struct or union.
char * is assumed to point to any type of object.
When both are specified, +Optrs_ansi takes precedence over +Optrs_strongly_typed.
For more information about type aliasing see the section "Aliasing Options" later in this
chapter.
+O[no]ptrs_strongly_typed
Optimization level(s): 2, 3, 4
Default: +Onoptrs_strongly_typed
Use +Optrs_strongly_typed when pointers are type-safe. The optimizer can use this
information to generate more efficient code.
Type-safe (that is, strongly-typed) pointers are pointers to a specific type that only point to
objects of that type, and not to objects of any other type. For example, a pointer declared as
a pointer to an int is considered type-safe if that pointer points to an object only of type
int, but not to objects of any other type.
Based on the type-safe concept, a set of groups are built based on object types. A given
group includes all the objects of the same type.
The term
type-inferred aliasing
is a concept which means any pointer of a type in a
given group (of objects of the same type) can only point to any object from the same group;
it can not point to a typed object from any other group.
For more information about type aliasing see the section "Aliasing Options" later in this
chapter.
Type casting to a different type violates type-inferring aliasing rules. See Example 2 below.
Dynamic casting is allowed. See Example 3 below.
+O[no]ptrs_strongly_typed (continued)
For finer detail, see the "[NO]PTRS_STRONGLY_TYPED pragma" section later in this
chapter..
Example 1: How Data Types Interact