Command Line Options

You can specify command-line options to the aCC command. They allow you to override the default actions of the compiler. Each option begins with either a - or a + sign. Any number of options can be interspersed anywhere in the aCC command and they are typically separated by blanks.
For a complete list of options, select Alphabetical List of Command Line Options. Otherwise, select a category:

See Also:


Alphabetical List of Command Line Options

Select the option for which you want more information:

Parallel Processing Options

HP aC++ provides the following optimization options for parallel code.

For More Information:

-mt
Automatically selects and sets flags for parallelization.
+O[no]autopar
Parallelize loops that are safe to parallelize.
+O[no]dynsel
Enable workload-based dynamic selection of parallelizable loops.
+O[no]loop_block
Enable [disable] blocking of eligible loops for improved cache performance.
+O[no]loop_unroll_jam
Enable [disable] loop unrolling and jamming.
+O[no]report[=report_type
Produce a Loop Report.

-mt Command Line Option Syntax

Description:

Easier use of threads with -mt

The new -mt option enables multi-threading capability without the need to set any other flags, such as -l and -D. aC++ examines your environment and automatically selects and sets the appropriate flags. There are four possible sets of flags depending on your operating system and which libstd you use.

Option matrix for -mt:

          |                                |
 ---------+--------------------------------+
 old-lib  |  -D_REENTRANT                  |
  libstd  |  -DRW_MULTI_THREAD             |
  1.2.1   |  -DRWSTD_MULTI_THREAD          |
  (-AP)   |  -D_THREAD_SAFE                |
    &     |  -D_POSIX_C_SOURCE=199506L     |
 librwtool|  -D_HPUX_SOURCE *              |
  7.0.x   |  -lpthread                     |
 ---------+--------------------------------|
 new-lib  |  -D_REENTRANT                  |
  (-AA)   |  -D_RW_MULTI_THREAD            |
          |  -D_RWSTD_MULTI_THREAD         |
  libstd  |  -D_POSIX_C_SOURCE=199506L     |
  2.2.1   |  -D_HPUX_SOURCE *              |
          |  -lpthread                     |
 ---------+--------------------------------+
* required if -D_POSIX_C_SOURCE used

Macros used to compile multi-thread source code:

_REENTRANT
Required by system header files that provide reentrant functions (suffixed by _r).
RW_MULTI_THREAD/_RW_MULTI_THREAD
Required by Rogue Wave toolsh++ header files and libraries. RW_MULTI_THREAD is used by toolsh++ 7.0.x. _RW_MULTI_THREAD is used by toolsh++ 8.x (not yet available).
RWSTD_MULTI_THREAD/_RWSTD_MULTI_THREAD
Required by Rogue Wave standard library header files and libraries. RWSTD_MULTI_THREAD is used by libstd 1.2.1. _RWSTD_MULTI_THREAD is used by libstd 2.2.1 when compiling with -AA.
_POSIX_C_SOURCE=199506L
Required by pthread.
_THREAD_SAFE
Required by thread safe cfront compatible libstream header files and library. For the frequently used objects cout, cin, cerr, and clog, you can specify the -D_THREAD_SAFE compile time flag for any file that includes . In this case, a new instance of the object is transparently created for each thread that uses it. All instances share the same file descriptor.
libpthread.*
Kernel thread library used on 11.x systems

For More Information:

+O[no]autopar Command Line Option Syntax

+O[no]autopar

Description:

When used with the +Oparallel option, +Oautopar causes the compiler to parallelize loops that are safe to parallelize. When used with +Oparallel, +Onoautopar causes the compiler not to parallelize any loops.

A loop is safe to parallelize if it has an iteration count that can be determined at runtime before loop invocation; it must contain no loop-carried dependences, procedure calls, or I/O operations. A loop-carried dependence exists when one iteration of a loop assigns a value to an address that is referenced or assigned on another iteration.

+Oautopar is the default for all optimization levels but is useful only at levels 3 and 4.

For More Information:

+O[no]dynsel Command Line Option Syntax

+O[no]dynsel

Description:

When specified with +Oparallel, the +Odynsel option enables workload-based dynamic selection of parallelizable loops. +Odynsel causes the compiler to generate either a parallel or a serial version of the loop. The loop's workload is compared to parallelization overhead, and the parallel version is run only if it is profitable to do so.

The +Onodynsel option disables dynamic selection and tells the compiler that it is profitable to parallelize all parallelizable loops.

If a loop's iteration count is known at compile time, this optimization is performed at compile time. If a loop's iteration count is not known until runtime, the optimization is performed at runtime.

The default is +Odynsel if +Oparallel is enabled at optimization level(s) 3 and 4.

For More Information:

+O[no]loop_block Command Line Option Syntax

+O[no]loop_block

Description:

The +O[no]loop_block option enables [disables] blocking of eligible loops for improved cache performance.

The default is +Onoloop_block at optimization level(s) 3 and 4.

For More Information:

+O[no]loop_unroll_jam Command Line Option Syntax

+O[no]loop_unroll_jam

Description:

The +O[no]loop_unroll_jam option enables [disables] loop unrolling and jamming. Loop unrolling and jamming increase register exploitation.

The default is +Onoloop_unroll_jam at optimization level(s) 3 and 4.

For More Information:

+O[no]report[=report_type] Command Line Option Syntax

+O[no]report[=report_type]

Description:

This option causes the compiler to display various optimization reports. The value of report_type determines which report is displayed, as described below:

The +Onoreport option does not accept any of the report_type values.

For More Information:

The +Oreport[=report_type] option is active only at optimization levels 3 and above. The default is +Onoreport.


Options to Control Code Generation

These options allow you to control what kind of code HP aC++ generates.
-Ae
Compile C source code.
-c
Compile to relocatable object file without linking
+DDdata_model
Generate object code for either the ILP32 or LP64 data model.
+DSmodel
Perform instruction scheduling tuned for a particular architecture.
-S
Compile to assembly language without linking.

-c Command Line Option Syntax

-c

Description:

Compiles one or more source files but does not enter the linking phase.

The compiler produces an object file (a file ending with .o) for each source file (a file ending with .c, .C, .s, or .i). Note that you must eventually link object files before they can be executed.

Example:

aCC -c sub.C prog.C

Compiles sub.C and prog.C and puts the relocatable object code in the files sub.o and prog.o, respectively.

+DDdata_model Command Line Option Syntax

+DDdata_model
data_model can be one of the following:

Description:

This option specifies the data model for the compiler.

ILP32 Data Model LP64 Data Model
The size of an int, long, or pointer data type is 32-bits. The size of an int data type is 32-bits. The size of a long or pointer data type is 64-bits.
The preprocessor predefined macro _ILP32 is defined. The preprocessor predefined macro, __LP64__ is defined. Also __LP64__ and _LP64.

Examples:

The following example generates code for the 64-bit data model.
aCC +DD64 app.C
The following example generates code for the 32-bit data model.
aCC app.C

+DSmodel Command Line Option Syntax

+DSmodel
model can be either of four values. The default is blended.
blended
Tune for a combination of processors: Itanium, McKinley, or native.
itanium
Tune for the Itanium processor
mckinley
Tune for the McKinley processor
native
Tune for the processor on which the compiler is running

Description:

Performs instruction scheduling tuned for a particular implementation of the IPF architecture.

Object code with scheduling tuned for a particular model will execute on other HP 9000 systems, although possibly less efficiently.

Using +DS to Specify Instruction Scheduling

Instruction scheduling is different on different implementations of IPF architectures. You can improve performance on a particular model or processor of the HP 9000 by requesting that the compiler use instruction scheduling tuned to that particular model or processor. Using scheduling for one model or processor does not prevent your program from executing on another model or processor.

When you use the +DS option depends on your particular circumstances.

Compiling in Networked Environments

When compiles are performed using diskless workstations or NFS-mounted file systems, it is important to note that the default code generation and scheduling are based on the local host processor. The system model numbers of the hosts where the source or object files reside do not affect the default code generation and scheduling.

-S Command Line Option Syntax

-S

Description:

Compiles the named HP aC++ program and leaves the assembly language output in a corresponding file with a .s suffix. The -S option is only for displaying the assembler code. The generated code is not intended to be used as input to the assembler (as).

Example:

aCC -S prog.C

Compiles prog.C to assembly code rather than to object code, and puts the assembly code in the file prog.s.


Symbol Binding

The following -B options are recognized by aCC to specify whether references to global symbols may be resolved to symbols defined in the current load module, or whether they must be assumed to be potentially resolved to symbols defined in another load module.

A global symbol is one that is visible by name across translation unit boundaries. A static symbol is one that is visible by name only within a single translation unit but is not associated with a particular procedure activation. A locally defined symbol is a global or static symbol with a definition in the translation unit from which it is being referenced.

-Bdefault
Symbols are assigned the default export class.
-Bextern
Inlining of import stubs for calls to default export class symbols.
-Bhidden
Symbols are assigned the hidden export class.
-Bprotected
Symbols assigned the protected export class.
-Bsymbolic
All symbols assigned the protected export class.

-Bdefault Command Line Option Syntax

-Bdefault

Description:

Global symbols are assigned the default export class. These symbols may be imported or exported outside of the current load module. The compiler will access tentative symbols through the linkage table. Any symbol that is not assigned to another export class through use of another -B option (or the deprecated +O[no]extern option) will have the default export class. The -Bdefault option may also be used on a per symbol basis to specify exceptions to global -Bprotected, -Bhidden, and -Bextern options.

Usage

-Bdefault=symbol[,symbol...]

The named symbols are assigned the default export class.

-Bdefault:filename

The file indicated by filename contains a list of symbols, separated by spaces or newlines. These symbols are assigned the default export class.

-Bextern Command Line Option Syntax

-Bextern

Description:

The specified symbols, or all undefined symbols if no list is provided, are assigned to default export class. Additionally, the compiler will inline the import stub for calls to these symbols. No compile time binding of these symbols will be done. All references to these symbols will be through the linkage table, so an unnecessary performance penalty will occur if -Bextern is applied to a listed symbol that is resolved in the same load module.

Usage

-Bextern=symbol[,symbol...]

The named symbols, or all symbols if no list is provided, are assigned the default export class.

-Bextern:filename

The file indicated by filename is expected to contain a list of symbols, separated by spaces or newlines. These symbols are assigned the default export class.

-Bhidden Command Line Option Syntax

-Bhidden

Description:

The specified symbols, or all symbols if no symbols are specified, are assigned the hidden export class. The hidden export class is similar to the protected export class. These symbols will not be preempted by symbols from other load modules, so the compiler may bypass the linkage table for both code and data references and bind them to locally defined code and data symbols. In addition, hidden symbols will not be exported outside the current load module. The linker may eliminate them from a shared library, but in an executable, they remain accessible to the debugger unless +Oprocelim is also specified.

When used with no symbol list, -Bhidden implies -Wl,-aarchive_shared, causing the linker to prefer an archive library over a shared library if one is available. This can be overridden by following the -Bhidden option with a subsequent -Wl,-a option.

Usage

-Bhidden=symbol[,symbol...] The named symbols, or all symbols if no symbols are specified, are assigned the hidden export class.

-Bhidden:filename

The file indicated by filename is expected to contain a list of symbols, separated by spaces or newlines. These symbols are assigned the hidden export class.

-Bprotected Command Line Option Syntax

-Bprotected

Description:

The specified symbols, or all symbols if no symbols are specified, are assigned the protected export class. That means these symbols will not be preempted by symbols from other load modules, so the compiler may bypass the linkage table for both code and data references and bind them to locally defined code and data symbols.

When used with no symbol list, -Bhidden implies -Wl,-archive_shared, causing the linker to prefer an archive library over a shared library, if one is available. This can be overridden by following the -Bhidden option with a subsequent -Wl,-a option.

Usage

-Bprotected_data

Marks only data symbols as having the protected export class.

-Bprotected_def

Same as -Bprotected but only locally defined (non-tentative) symbols are assigned the protected export class.

-Bprotected:filename

The file indicated by filename is expected to contain a list of symbols, separated by spaces or newlines. These symbols are assigned the protected export class.

-Bprotected=symbol[,symbol...] The named symbols, or all symbols if no symbols are specified, are assigned the protected export class.

-Bsymbolic Command Line Option Syntax

-Bsymbolic

Description:

All symbols are assigned the protected export class. Equivalent to -Bprotected with no symbol list.

Data Alignment and Storage

Default Data Storage and Alignment

This section describes default data storage allocation and alignment for HP aC++ data types.

Data storage refers to the size of data types, such as bool, short, int, float, and char*. Data alignment refers to the way the HP aC++ compiler aligns data structures in memory. Data type alignment and storage differences can cause problems when moving data between systems that have different alignment and storage schemes. These differences become apparent when a structure is exchanged between systems using files or inter-process communication. In addition, misaligned data addresses can cause bus errors when an attempt is made to dereference the address.

The following table lists the sizes and alignments of HP aC++ data types:

Data Type Size in Bytes Alignment
bool 1 1-byte
char, unsigned char, signed char 1 1
wchar_t 4 4
short, unsigned short, signed short 2 2
int, unsigned int 4 4
long, unsigned long 4 * 4 *
float 4 4
_float80 80 in floating register.
128 in memory.
16
_float128 16 16 in +DD64.
8 otherwise.
double 8 8
long double 16 8 **
long long, unsigned long long 8 8
enum 4 4
arrays size of array element type alignment of array element type
struct *** 1-, 2-, 4-, or 8-byte
union *** 1-, 2-, 4-, or 8-byte
bit-fields size of declared type alignment of declared type
pointer 4 * 4 *

* In 64-bit mode, long, unsigned long, and pointer data types are 8 bytes long and 8-byte aligned.

** In 64-bit mode, long double is 16-byte aligned.

*** struct and union alignment is the same as the strictest alignment of any member. Padding is done to a multiple of the alignment size.


Debugging Options

Debugging options enable you to use the HP WDB Debugger.

+d
Disable all inlining of functions.
-g
Generate minimal information for debugging.
-g0
Generate full information for debugging.
-g1
Generate minimal information for debugging.
+[no]objdebug
Generate debug information in object files and not in the executable.

+d Command Line Option Syntax

+d

Description:

Prevents the expansion of inline functions.

This option is useful when you are debugging your code because you cannot set breakpoints at inline functions. This option defeats inlining thereby allowing you to set breakpoints at functions specified as inline.

See Also:

-g Command Line Option Syntax

-g

Description:

Like the -g1 option, -g causes the compiler to generate minimal information for the debugger. It uses an algorithm that attempts to reduce duplication of debug information.

To suppress expansion of inline functions use the +d option.

For More Information:

-g0 Command Line Option Syntax

-g0

Description:

-g0 causes the compiler to generate full debug information for the debugger.

To suppress expansion of inline functions use the +d option.

For More Information:

-g1 Command Line Option Syntax

-g1

Description:

Like the -g option, -g1 causes the compiler to generate minimal information for the debugger. It uses an algorithm that attempts to reduce duplication of debug information.

To suppress expansion of inline functions use the +d option.

For More Information:

Difference between -g, -g0, and -g1

The -g, -g0, and -g1 options all generate debug information. The difference is that the -g0 option emits full debug information about every class referenced in a file, which can result in some redundant information.

The -g and -g1 options, on the other hand, emit a subset of this debug information, thereby decreasing the size of your object file. If you compile your entire application with -g or -g1 no debugger functionality is lost.

NOTE: If you compile part of an application with -g or -g1 and part with debug off, (that is, with neither the -g, the -g0, nor the -g1 option) the resulting executable may not contain complete debug information. You will still be able to run the executable, but in the debugger, some classes may appear to have no members.

When to Use -g, -g0, or -g1

Use -g or -g1 when

Use -g0 when either of the following is true:

NOTE: If you compile part of an application with -g or -g1 and part with debug off, (that is, with neither the -g, the -g0, nor the -g1 option) the resulting executable may not contain complete debug information. You will still be able to run the executable, but in the debugger, some classes may appear to have no members.

For More Information:

-g, -g1 Algorithm

In general, the compiler looks for the first non-inline, non-pure (non-zero) virtual function in order to emit debug information for a class.

If there are no virtual member functions, the compiler looks for the first non-inline member function.

If there are no non-inline member functions, debug information is always generated.

A problem occurs if all functions are inline; in this case, no debug information is generated.

+[no]objdebug Command Line Option Syntax

+[no]objdebug

Description:

Generate [do not generate] debug information in object files and not in the executable. The HP WDB debugger then reads the object files to construct debugging information.

CAUTION: With +objdebug, the object files or archive libraries must not be removed.

+objdebug is the default at link time and at compile time.

If +noobjdebug is used at link time (not the default), all debug information goes into the executable, even if some objects were compiled with +objdebug.

If +objdebug is used at compile time, extra debug information is placed into each object file to help the debugger locate the object file and to quickly find global types and constants.

Usage

Use +objdebug option to enable faster links and smaller executable file sizes for large applications, rather than +noobjdebug where debug information is written to the executable.

Use +[no]objdebug with the -g, -g0, or -g1 option.

For More Information:


Error Handling Options

Use these options to control how potential errors in your C++ code are detected and handled.

+p
Disallows all anachronistic constructs.
-w
Suppresses all compiler warning messages.
+w
Warns about all questionable constructs.
+W args
Selectively suppress compiler warnings.
+We args
Selectively interpret warnings or future errors as errors.

+p Command Line Option Syntax

+p

Description:

Disallows all anachronistic constructs.

Ordinarily, the compiler gives warnings about anachronistic constructs. Using the +p option, the compiler gives errors for anachronistic constructs.

Example:

aCC +p file.C
Compiles file.C and gives errors for all anachronistic constructs rather than just giving warnings.

-w Command Line Option Syntax

-w

Description:

Suppresses all warning messages.

By default, HP aC++ reports all errors and warnings.

Example:

aCC -w file.C
Compiles file.C and reports errors but does not report any warnings.

+w Command Line Option Syntax

+w

Description:

Warns about all questionable constructs, as well as constructs that are almost certainly problems.

The default is to warn only about constructs that are almost certainly problems.

For example, this option warns you when calls to inline functions cannot be expanded inline.

Example:

aCC +w file.C
Compiles file.C and warns about both questionable constructs and constructs almost certainly problematic.

+W args Command Line Option Syntax

+W arg1[,arg2,..argn]

Description

Selectively suppresses any specified warning messages, where arg1 through argn are valid compiler warning message numbers.

Example:

aCC +W600 app.C

+We args Command Line Option Syntax

+We arg1[,arg2,..argn]

Description

Selectively interpret any specified warning or future error messages as errors. arg1 through argn are valid compiler warning message numbers.

Example:

aCC +We 600,829 app.C


Exception Handling Option

By default, exception handling is in effect. To turn off exception handling, you must use the following option.

+noeh Command Line Option Syntax

+noeh

Description:

Disables exception handling.

By default, exception handling is on. To turn off exception handling, you must use this option. With exception handling disabled, the keywords "throw" and "try" generate an error.

Code compiled with and without +noeh can be mixed freely.

Example:

aCC +noeh progex.C
Compiles and links progex.C, which does not use exception handling.

For More Information:


Extensions to the Language

This option supports extensions to the C++ language.

-ext Command Line Option Syntax

-ext

Description:

When you specify -ext, you are enabling the following HP aC++ extensions to the C++ standard:

HP aC++ Extentions
Enable 64-bit integer data type support for:
  • long long (signed 64-bit integer)
  • unsigned long long (unsigned 64-bit integer)

Use this option to declare 64-bit integer literals and for input and output of 64-bit integers.

Enable #assert and #unassert preprocessor directives allowing you to set a predicate name or predicate name and token to be tested with a #if directive.

Note, when using -ext, specify it at both compile and link time.

Example:

aCC -ext foo.C

Compiles foo.C which contains a long long declaration.

#include <iostream.h>

void main(){ long long ll = 1; cout << ll << endl; }


Floating Point Processing

+O[no]aggressive
Optimizations that may change the behavior of code.
+Ofenvaccess
Access [do not access] the floating point environment.
+O[no]fltacc
Disable [enable] all optimizations that cause imprecise floating-point results.
+O[no]libmerrno
Enable/disable support for errno in libm functions.
+O[no]moveflops
Move [do not move] conditional floating-point instructions out of loops.
-fpeval
Specify minimum precision for expression evaluation.
-fpwidetypes
Enables extended and quad data types.
+FP
Enables trapping behaviors.

+Ofenvaccess Command Line Option Syntax

+Ofenvaccess

Description

This option provides a means to inform the compiler when a program might access the floating point environment to test flags or run under non-default modes. Use of the option allows certain optimizations that could subvert flag tests and mode changes such as global common subexpression elimination, code motion, and constant folding.

-fpeval Command Line Option Syntax

-fpeval=precision

Description

Specifies the minimum precision to use for floating point expression evaluation. The possible values for precision are float, double, and extended. This option does not affect the precision of parameters, return types, or assignments. The default is -fpeval=float.

-fpwidetypes Command Line Option Syntax

-[no]fpwidetypes

Description

Enables the extended and quad floating point data types. The default is -nofpwidetypes. The compiler defines _FPWIDETYPES when -fpwidetypes is in effect.

+FP Command Line Option Syntax

+FP[flags]

Description:

Specifies how the runtime environment for floating point operations
should be initialized at program startup and used at link time.  The
default is that all trapping behaviors are disabled.

The following flags are supported.  Upper case enables the flag,
lower case disables the flag.

V (v)     Trap on invalid floating-point operations

Z (z)     Trap on divide by zero

O (o)     Trap on floating-point overflow

U (u)     Trap on floating-point underflow

I (i)     Trap on floating-point operations that produce inexact results.

D (d)     Enable sudden underflow (flush to zero) of denormalized values.

To dynamically change these settings at run-time, see fesettrapenable(3M).

+O[no]libmerrno Command Line Option Syntax

+O{no}libmerrno

Description

Enable/disable support for errno in libm functions. The default is +Onolibmerrno.


Header File Options

-Idirectory
Add directory to the directories to be searched for #include files.
-I-
Override the default -Idirectory search-path.
+m[d]
Output quote enclosed (" ") make(1) dependency files to stdout or to a .d file.
+M[d]
Output both quote enclosed and angle bracket enclosed (< >) make(1) dependency files to stdout or to a .d file.

For More Information:

-Idirectory Command Line Option Syntax

-I directory

directory is the HP-UX directory where HP aC++ looks for header files.

Description:

During the compile phase, adds directory to the directories to be searched for #include files during preprocessing. During the link phase, adds directory to the directories to be searched for #include files by the link-time template processor.

For #include files that are enclosed in double quotes ("  ") within a source file and do not begin with a /, the preprocessor searches in the following order:

  1. The directory of the source file containing the #include.
  2. The directory named in the -I option.
  3. The standard include directories /opt/aCC/include and /usr/include.

For #include files that are enclosed in angle brackets (< >), the preprocessor searches in the following order:

  1. The directory named in the -I option.
  2. The standard include directories /opt/aCC/include and /usr/include.

    (The current directory is not searched when angle brackets (< >) are used with #include.)

Example:

aCC -I include file.C

This example directs HP aC++ to search in the directory include for #include files.

-I- Command Line Option Syntax

[-Idirs] -I- [-Idirs]
[-Idirs] indicates an optional list of -Idirectory specifications in which a directory name cannot begin with a hyphen (-) character.

Description:

The -I- option allows you to override the default -Idirectory search-path. This feature is called view-pathing.

Specifying -I- serves a dual purpose, as follows:

The standard aCC include directories (/usr/include and /opt/aCC/include*) are always searched last for both types of include files.

Usage:

View-pathing can be particularly valuable for medium to large sized projects. For example, imagine that a project comprises two sets of directories. One set contains development versions of some of the headers that the programmer currently modifies. A mirror set contains the official sources.

Without view-pathing, there is no way to completely replace the default -Idirectory search-path with one customized specifically for project development.

With view-pathing, you can designate and separate official directories from development directories and enforce an unconventional search-path order. For quote enclosed headers, the preprocessor can include any header files located in development directories and, in the absence of these, include headers located in the official directories.

If -I- is not specified view-pathing is turned off. This is the default.

Examples

With view-pathing off, the following example obtains all quoted include files from dir1 only if they are not found in the directory of a.C and from dir2 only if they are not found in dir1. Finally, if necessary, the standard include directories are searched. Angle-bracketed includes are searched for in dir1, then dir2, followed by the standard include directories.
aCC -Idir1 -Idir2 -c a.C
With view-pathing on, the following example searches for quoted include files in dir1 first and dir2 next, followed by the standard include directories, ignoring the directory of a.C. Angle-bracketed includes are searched for in dir2 first, followed by the standard include directories.
aCC -Idir1 -I- -Idir2 -c a.C
CAUTION: Some of the compiler's header files are included using double quotes. Since the -I- option redefines the search order of such includes, if any standard headers are used, it is your responsibility to supply the standard include directories (/opt/aCC/include* and /usr/include) in the correct order in your -I- command line.

For example, when using -I- on the aCC command line, any specified -I directory containing a quoted include file having the same name as an HP-UX system header file, may cause the following possible conflict. (In general, if your application includes no header having the same name as an HP-UX system header, there is no chance of a conflict.)

Suppose you are compiling program a.C with view-pathing on. a.C includes the file a.out.h which is a system header in /usr/include:

aCC -IDevelopmentDir -I- -IOfficialDir a.C
If a.C contains:
// This is the file a.C
#include <a.out.h>
// ...
When a.out.h is preprocessed from the /usr/include directory, it includes other files that are quote included (like #include "filehdr.h").

Since with view-pathing, quote enclosed headers are not searched for in the including file's directory, filehdr.h which is included by a.out.h will not be searched for in a.out.h's directory (/usr/include). Instead, for the above command line, it is first searched for in DevelopmentDir, then in OfficialDir and if it is found in neither, it is finally searched for in the standard include directories (/opt/aCC/include* and /usr/include) in the latter of which it will be found.

However, if you have a file named filehdr.h in DevelopmentDir or OfficialDir, that file (the wrong file) will be found.


Online Help Option Syntax

+help Command Line Option Syntax

+help

Description:

Invokes the initial menu window of this HP aC++ Online Programmer's Guide.

If +help is used on any command line, the compiler displays the online programmer's guide with the default web browser and then processes any other arguments.

If $DISPLAY is set, the default web browser is displayed. If the display variable is not set, a message so indicates. Set your $DISPLAY variable as follows:

export DISPLAY=YourDisplayAddress      (ksh/sh shell notation)

setenv DISPLAY YourDisplayAddress      (csh shell notation)

Examples:

To use a browser other than the default, first set the BROWSER environment variable to the alternate browser's location:
export BROWSER=AlternateBrowserLocation

To invoke the online guide:

aCC +help

Inlining Options

These options allow you to specify the amount of source code inlining done by the HP aC++ compiler.

+d
Disables all inlining of functions.
+inline_level [i]num
Controls how C++ inlining hints influence HP aC++. Also allows inlining of small functions that are not explicitly tagged with the inline keyword.

See Also:

+inline_level [i]num Command Line Option Syntax

+inline_level [i]num

Description

This option controls how C++ inlining hints influence HP aC++. Such inlining happens in addition to explicitly inlined functions. By default, this option is off.

Specifying i causes implicit inlining of small functions.

Specify num as 0, 1, 2, or 3. Refer to the tables below.

Note that +d and +inline_level 0 turn off all inlining, including implicit inlining.

num Meaning
0 No inlining is done (same effect as the +d option).
1 Only small functions are inlined.
2 Only large functions are not inlined.
3 Inlining hints are respected in all cases, except when the called function is recursive or when it has a variable number of arguments.

The default level depends on +Oopt as shown in the following table:

opt num
0 1
1 1
2 2
3 2
4 2

NOTE: This option controls functions declared with the inline keyword or within the class declaration and is effective at all optimization levels.

The options +O[no]inline and +Oinlinebudget control the high level optimizer that recognizes other opportunities in the same source file (+O3) or amongst all source files (+O4).

Example:

aCC +inline_level3 app.C

See Also:


Library Options

Library options allow you to create, use, and manipulate libraries.
-AA
Enable use of Rogue Wave Standard C++ Library 2.2.1 and set all standards related options on.
-b
Create a shared library.
-dynamic
Specify dynamically bound executables.
-exec
Create an executable file from an object file.
-lname
Specify a library for the linker to search.
-Ldirectory
Specify a directory for the linker to search for libraries.
-minshared
Indicate an executable makes minimal use of shared libraries.
+nostl
Suppress searching of default -I and -L directory paths and some -l libraries.
-Wx,args
One use of -W is to specify linking of shared or archive libraries.

See Also:

-b Command Line Option Syntax

-b

Description:

Creates a shared library rather than an executable file.

Example:

aCC -b utils.o -o utils.so

Links utils.o and creates the shared library utils.so.

For More Information:

For more information on shared libraries, see Creating and Using Shared Libraries, and the HP-UX Online Linker and Libraries User's Guide.

-dynamic Command Line Option Syntax

-dynamic

Description:

Produces dynamically bound executables. See -minshared for partially statically bound executables. The default behavior is dynamic.

-exec Command Line Option Syntax

-exec

Description:

Indicates that any object files created will be used to create an executable file. Constants with a protected or hidden export class are placed in the read-only data section. This option also implies -Bprotected and -dynamic.

-lname Command Line Option Syntax

-lname
The name parameter forms part of the name of the library the linker searchs when looking for routines called by your program.

Description:

Causes the linker to search one of the following default libraries, if they exist, in an attempt to resolve unresolved external references: Whether it searches the shared library (.so) or the archive library (.a) depends on the value of the -a linker option or the -minshared compiler option.

NOTE: Because a library is searched when its name is encountered, placement of a -l is significant. If a file contains an unresolved external reference, the library containing the definition must be placed after the file on the command line. For details refer to the description of ld in the HP-UX Reference Manual or the ld(1) man page if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)

Example:

aCC file.o -lnumeric

This example directs the linker to link file.o and (by default) search the library /usr/lib/hpux32/libnumeric.so.

See Also:

-Ldirectory Command Line Option Syntax

-Ldirectory
The directory parameter is the HP-UX directory where you want the linker to search for libraries your program uses before searching the default directories.

Description:

Causes the linker to search for libraries in directory in addition to using the default search path.

See the -l option for default search path.

The -L option must precede any -lname option entry on the command line; otherwise -L is ignored. This option is passed directly to the linker.

Example:

aCC -L/project/libs prog.C -lmylib1 -lmylib2

Compiles and links prog.C and directs the linker to search the directories and /project/libs for any libraries that prog.C uses (in this case, mylib1 and mylib2).

See Also:

-minshared Command Line Option Syntax

-minshared

Description:

Indicates that the result of the current compilation is going into an executable file that will make minimal use of shared libraries. Equivalent to -exec -Bprotected.

+nostl Command Line Option Syntax

+nostl

Description:

By eliminating references to the standard header files and libraries bundled with HP aC++, this option allows experienced users full control over the header files and libraries used in compilation and linking of their applications, without potential complicatons that arise in mixing different libraries.

+nostl suppresses linking of all default -Idirectory and -Ldirectory paths and some of the -lname libraries (-lstd and -lstream). Use the -v option to see the effect of +nostl.

CAUTION: Complete understanding of the linking process and the behavior of the actual (third party) libraries linked with the application is essential for avoiding link or run-time failures.

For More Information:

For more information on shared libraries, see the tutorial Creating and Using Shared Libraries and the HP-UX Online Linker and Libraries User's Guide.


Linker Options

You can specify the following linker options on the compiler command line:

-n
The linker marks the output as sharable.
-N
The linker marks the output as unsharable.
-q
The linker marks the output as demand-loadable.
-Q
The linker marks the output as not demand-loadable.
-s
The linker strips the symbol table from the executable file it produces.
-z
The linker disallows dereferencing of null pointers at run time.

In addition, you can use the -Wl,args compiler option to specify any linker option on the compiler command line. For more information on linker options, see the ld(1) man page or the HP-UX Reference Manual.

CAUTION: You must use the aCC command to link your HP aC++ programs and libraries. This ensures that all libraries and other files needed by the linker are available.

-n Command Line Option Syntax

-n

Description:

Causes the program file produced by the linker to be marked as sharable.

For More Information:

For details and system defaults, refer to the description of ld in the HP-UX Reference Manual or the ld(1) man page if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)

See Also:

See also the -N option.

-N Command Line Option Syntax

-N

Description:

Causes the program file produced by the linker to be marked as unsharable.

Unsharable executable files generated with the -N option cannot be executed with exec.

For More Information:

For details and system defaults, refer to the ld description in the HP-UX Reference Manual or the ld(1) man page if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)

See Also:

-q Command Line Option Syntax

-q

Description:

Causes the output file from the linker to be marked as demand-loadable.

For More Information:

For details and system defaults, see the description of ld in the HP-UX Reference Manual or the ld(1) man page if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)

-Q Command Line Option Syntax

-Q

Description:

Causes the program file from the linker to be marked as not demand-loadable.

For More Information:

For details and system defaults, see the description of ld in the HP-UX Reference Manual or the ld(1) man page if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)

-s Command Line Option Syntax

-s

Description:

Causes the executable program file created by the linker to be stripped of symbol table information.

Specifying this option prevents using a symbolic debugger on the resulting program.

For More Information:

For more details, refer to the description of ld in the HP-UX Reference Manual or the ld(1) man page if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)


Options for Naming the Output File

These options allow you to name the compilation output file something other than the default name.

-o outfile
Specifies the name of the output file from the compilation.
-.suffix
Specifies a file name suffix to be used for the output file from the compilation.

-o Command Line Option Syntax

-o outfile
The outfile parameter is the name of the file containing the output of the compilation.

Description:

Causes the output of the compilation to be placed in outfile.

Without this option the default name is a.out. When compiling a single source file with the -c option, you can use the -o option to specify the name and location of the object file.

-.suffix Command Line Option Syntax

-.suffix
The suffix parameter represents the character or characters to be used as the output file name suffix.

suffix cannot be the same as the original source file name suffix.

Description:

Causes HP aC++ to direct output from the -E option into a file with the corresponding .suffix instead of into a corresponding .c file.

Example:

aCC -E -.i prog.C

Preprocesses the C++ code in prog.C and puts the resulting code in the file prog.i.


Option to Enable Native Language Support

-Y Command Line Option Syntax

-Y

Description:

Enables Native Language Support (NLS) of 8-bit, 16-bit and 4-byte EUC characters in comments, string literals, and character constants.

The language value (refer to environ(5) for the LANG environment variable) is used to initialize the correct tables for interpreting comments, string literals, and character constants. The language value is also used to build the path name to the proper message catalog.

For More Information:

Refer to hpnls, lang, and environ in the HP-UX Reference Manual for a description of the NLS model.


Option for Handling Null Pointers

-z Command Line Option Syntax

-z

Description:

This ld(1) option disallows dereferencing of null pointers at run time.

Fatal errors result if null pointers are dereferenced. If you attempt to dereference a null pointer, a SIGSEGV error occurs at run time.

Example:

aCC -z file.C
Compiles file.C and generates code to disallow dereferencing of null pointers.

For More Information:

See signal(2) and signal(5) for more information. (If you see the message "Man page could not be formatted," ensure the man page is installed.)


Options for Optimizing Your Code

Optimization options can be used to improve the execution speed of programs compiled with HP aC++.

To use optimization, first specify the appropriate basic optimization level (+O1, +O2, +O3, or +O4) on the aCC command line followed by one or more finer or more precise options when necessary. For an introduction with examples, refer to Optimizing HP aC++ Programs.

Categories of options are listed below.

For More Information:

Basic Optimization Level Options

These options allow you specify the basic level of optimization.
-O
Specify level 2 optimization.
+O0
Specify level 0 optimization.
+O1
Specify level 1 optimization.
+O2
Specify level 2 optimization.
+O3
Specify level 3 optimization.
+O4
Specify level 4 optimization.

-O Command Line Option Syntax

-O

Description:

Invokes the optimizer to perform level 2 optimization.

Example:

aCC -O prog.C
Compiles prog.C and optimizes at level 2.

For More Information:

You can set other optimization levels by using the following options:

See Also:

+O0 Command Line Option Syntax

+O0

Description:

Use +O0 for fastest compile time or with simple programs. No optimizations are performed.

Example:

aCC +O0 prog.C
Compiles prog.C and optimizes at level 0.

For More Information:

You can set other optimization levels by using the following options:

See Also:

+O1 Command Line Option Syntax

+O1

Description:

Performs level 1 optimization only. This includes branch optimization, dead code elimination, faster register allocation, instruction scheduling, and peephole optimization. This is the default optimization level.

Example:

aCC +O1 prog.C
Compiles prog.C and optimizes at level 1.

For More Information:

You can set other optimization levels by using the following options:

See Also:

+O2 Command Line Option Syntax

+O2

Description:

Performs level 2 optimization. This includes level 1 optimizations plus optimizations performed over entire functions in a single file.

Example:

aCC +O2 prog.C
Compiles prog.C and optimizes at level 2.

For More Information:

You can set other optimization levels by using the following options:

See Also:

+O3 Command Line Option Syntax

+O3

Description:

Performs level 3 optimization. This includes level 2 optimizations plus full optimization across all subprograms within a single file.

Example:

aCC +O3 prog.C
Compiles prog.C and optimizes at level 3.

For More Information:

You can set other optimization levels by using the following options:

See Also:

+O4 Command Line Option Syntax

+O4

Description:

Performs level 4 optimization. This includes level 3 optimizations plus full optimizations across the entire application program.

When you link a program, the compiler brings all modules that were compiled at optimization level 4 into virtual memory at the same time. Depending on the size and number of the modules, compiling at +O4 can consume a large amount of virtual memory. If you are linking a large program that was compiled with the +O4 option, you may notice a system slow down. In the worst case, you may see an error indicating that you have run out of memory.

If you run out of memory when compiling at +O4 optimization, there are several things you can do:

  1. Compile at +O4 only those modules that need to be compiled at optimization level 4, and compile the remaining modules at a lower level.

  2. If you still run out of memory, increase the per-process data size limit. Run the System Administrator Manager (SAM) to increase the maxdsiz process parameter from 64 MB to 128 MB. This procedure provides the process with additional data space.

    Refer to the System Administration Tasks manual, Chapter 11, "Reconfiguring the HP-UX Kernel." See Appendix A for full descriptions of the different process parameters, including maxdsiz.

  3. If increasing the per-process data size limit does not solve the problem, increase the system swap space. Refer to the System Administration Tasks manual, Chapter 6, "Managing Swap Space." Pay particular attention to the section "Adding File System Swap", because adding file system swap is easier than increasing the amount of device swap, which requires re-configuring your disk. However, if you find that you are consistently compiling beyond the available amount of device swap, you may not have a choice.

    For a complete discussion of swap space, refer to How HP-UX Works: Concepts for the System Administrator.

    Object Files Generated at Optimization Level 4

    Object files generated by the compiler at optimization level 4, called intermediate object files, are intended to be temporary files. These object files contain an intermediate representation of the user code in a format that is designed for advanced optimizations. Therefore, Hewlett-Packard reserves the right to change the format of these files without prior notice. There is no guarantee that intermediate object files will be compatible from one revision of the compiler to the next. The compiler will issue an error message and terminate when an incompatible intermediate file is generated.

    Example:

    aCC +O4 prog.C
    
    Compiles prog.C and optimizes at level 4.

    For More Information:

    You can set other optimization levels by using the following options:

    See Also:

    Additional Optimizations for Finer Control

    +ES[no]lit
    Place string literals into read-only memory.
    -fast
    Select a set of options for optimum execution speed for reasonable build times.
    +O[no]all
    Perform maximum optimization.
    +O[no]aggressive
    Optimizations that may change the behavior of code.
    +O[no]conservative
    Optimize with the minimum risk of side effects.
    +O[no]limit
    Optimize using [un]restricted compile time.
    +O[no]size
    Enable [disable] code expanding optimizations.

    +ES[no]lit Command Line Option Syntax

    Syntax

    +ES[no]lit
    

    Description:

    Places string literals into read-only memory. This is the default. This option may reduce memory requirements and improve run-time speed in multi-user applications.

    In A.03.15, A.01.23, and prior compiler versions, only floating-point constant values were placed in read-only memory. Other constants and literals were placed in read-write memory. This behavior remains available by specifying the +ESnolit option when compiling.

    As +ESlit allows the placement of string literals into read-only memory, all users of an application share this data. Whereas, each user is allocated a private copy of the data stored in read-write memory. By moving additional data from read-write storage to read-only storage, overall system memory requirements can be reduced and run-time speed improved. In addition, the compiler may also group identical strings, further reducing memory usage.

    NOTE: When +ESlit is in effect, you should not attempt to modify string literals, because all string literals are placed in read-only memory. Particularly, the following C library functions should be used with care, since they can alter the contents of a string literal that is specified as the receiving string.

    extern char *strncat(char *, const char *, size_t);
    extern void *memmove(void *, const void *, size_t);
    extern char *strcpy(char *, const char *);
    extern char *strncpy(char *, const char *, size_t);
    extern char *strcat(char *, const char *);
    extern char *strtok(char *, const char *);
    
    Following is an example of code that attempts to modify read-only memory. A compile-time error is generated unless a cast is done, in which case there is no message. At runtime, a SIGBUS signal is generated.
    int main()
    {
         static const char *p = "Now is the time";
         char *q;
    
         // .....
    
         q = (char*)p;		// cast to q
    
    // OR
    //  q = const_cast(p);  // const cast to q
    
        *q = 'd';			// Very bad! Application core dump
    
        // .....
    
    }
    

    +O[no]all Command Line Option Syntax

    +O[no]all
    

    Description:

    Use +Oall to obtain the best possible performance.

    This option should be used with stable, well-structured code. These optimizations give you the fastest code, but are riskier than the default optimizations.

    You can use +Oall at optimization levels 2, 3, and 4. The default is +Onoall.

    Examples:

    aCC +Oall prog.C
    
    Compiles prog.C and optimizes for best performance.

    aCC -O +Oall prog.C
    
    Compiles prog.C and optimizes at level 2 with aggressive optimizations and unrestricted compile time.

    For More Information:

    The +Oall option without +O2, +O3, or +O4 combines the following options:

    +O[no]aggressive Command Line Option Syntax

    +O[no]aggressive
    

    Description:

    The +Oaggressive option enables aggressive optimizations. The +Onoaggressive option disables aggressive optimizations.

    Aggressive optimizations can result in significant performance improvement, but can change program behavior. They can:

    Use +Oaggressive with optimization levels 2, 3, or 4. By default, aggressive optimizations are turned off.

    Example:

    To enable aggressive optimizations at the second, third, or fourth optimization levels, type:

    aCC +O2 +Oaggressive sourcefile.C
    
    or:
    aCC +O3 +Oaggressive sourcefile.C
    
    or:
    aCC +O4 +Oaggressive sourcefile.C
    

    For More Information:

    The +Oaggressive option invokes the following advanced optimization options:

    +O[no]conservative Command Line Option Syntax

    +O[no]conservative
    

    Description:

    The +Oconservative option causes the optimizer to make conservative assumptions about application code and enable only conservative optimizations, a subset of basic optimizations.

    Use +Oconservative at optimization levels 2, 3, or 4 when your source code is unstructured or you are unfamiliar with the source code being optimized. The default is +Onoconservative.

    Example:

    To enable conservative optimizations at the second, third, or fourth optimization levels, use the +Oconservative option as follows:

    aCC +O2 +Oconservative sourcefile.C
    
    or:
    aCC +O3 +Oconservative sourcefile.C
    
    or:
    aCC +O4 +Oconservative sourcefile.C
    

    +O[no]limit Command Line Option Syntax

    +O[no]limit
    

    Description:

    The +Olimit option suppresses optimizations that significantly increase compile-time or that consume a lot of memory.

    The +Onolimit option enables optimizations regardless of their effect on compile time or memory consumption.

    Use +Onolimit with optimization levels 2, 3, or 4. The default is +Olimit.

    Example:

    To remove optimization time restrictions at the second, third, or fourth optimization levels, use +Onolimit as follows:

    aCC +O2 +Onolimit sourcefile.C
    
    or:
    aCC +O3 +Onolimit sourcefile.C
    
    or:
    aCC +O4 +Onolimit sourcefile.C
    

    +O[no]size Command Line Option Syntax

    +O[no]size
    

    Description:

    While most optimizations reduce code size, the +Osize option suppresses those few optimizations that significantly increase code size. The +Onosize option enables code-expanding optimizations.

    Use +Osize at optimization levels 2, 3, or 4. The default is +Onosize.

    Example:

    To disable code size expanding optimizations at the second, third, and fourth optimization levels, use +Osize as follows:

    aCC +O2 +Osize sourcefile.C
    
    or:
    aCC +O3 +Osize sourcefile.C
    
    or:
    aCC +O4 +Osize sourcefile.C
    

    Advanced +Ooptimization Options

    Advanced optimization options provide additional control for special situations.

    +O[no]cross_region_addressing
    Enable [disable] cross region addressing.
    +O[no]dataprefetch
    Enable [disable] optimizations to generate data prefetch instructions for data structures referenced within innermost loops.
    +O[no]extern
    Perform [do not perform] optimization for a specified set of symbols.
    +O[no]fltacc
    Disable [enable] all optimizations that cause imprecise floating-point results.
    +Ofrequently_called
    Identify functions that are frequently called.
    +O[no]initcheck
    Enable [disable] initialization of uninitialized scalar variables to null values.
    +O[no]inline
    Inline [do not inline] procedure calls.
    +Oinlinebudget
    Inline aggressively.
    +Olevel=name1[,name2,...nameN]
    Lower the optimization level for one or more named functions.
    +O[no]looptransform
    Transform [do not transform] eligible loops for improved cache performance.
    +O[no]moveflops
    Move [do not move] conditional floating-point instructions out of loops.
    +O[no]parminit
    Enable [disable] automatic initialization of unspecified function parameters
    +O[no]parmsoverlap
    Assume [do not assume] that arguments of function calls overlap in memory.
    +O[no]procelim
    Enable [disable] elimination of unreferenced procedures.
    +O[no]promote_indirect_calls
    Enable [disable] the promotion of indirect calls to direct calls.
    +Orarely_called
    Identify functions that are rarely called.
    +O[no]recovery
    Generate recovery code for control speculation.
    +Oshortdata[=size]
    Place objects in shortdata area.
    +O[no]store_ordering
    Preserve original program order for stores.

    +O[no]cross_region_addressing Command Line Option Syntax

    +O[no]cross_region_addressing
    

    Enables [disables] the use of cross-region addressing. Cross-region addressing is required if a pointer, such as an array base, points to a different region than the data being addressed due to an offset that results in a cross-over into another region. Standard conforming applications do not require the use of cross-region addressing. The default is +Onocross_region_addressing.

    +O[no]dataprefetch Command Line Option Syntax

    +O[no]dataprefetch
    

    Description:

    When +Odataprefetch is enabled, the optimizer inserts instructions within innermost loops to explicitly prefetch data from memory into the data cache. Data prefetch instructions are inserted only for data structures referenced within innermost loops using simple loop varying addresses (that is, in a simple arithmetic progression).

    Use this option for applications that have high data cache miss overhead.

    You can use +Odataprefetch at optimization levels 2, 3, and 4. The default is +Onodataprefetch.

    Usage

    +Odataprefetch=kind

    The defined values for kind are:

         direct
               Enable generation of data prefetch instructions
               for the benefit of direct memory accesses, but
               not indirect memory accesses.
    
         indirect
               Enable generation of data prefetch instructions
               for the benefit of both direct and indirect memory
               accesses.  This is the default at optimization
               levels +O2 and above.
    
         none
               Disable generation of data prefetch instructions.
               This is the default at optimization levels +O1
               and below.
    

    +O[no]extern Command Line Option Syntax

    +O[no]extern
    

    Description:

    The +O[no]extern option allows you to specify which accesses to symbols in an executable or shared library (a load module) can be optimized.

    NOTE: Use of +Onoextern creates code that cannot be included in a shared library. Use +Onoextern only to build executables.

    Only internal symbols (defined in the load module) can be optimized. If +Onoextern is specified, the compiler assumes that no symbols are external to the load module being compiled, and any symbol can be optimized. If +Oextern is specified, the compiler assumes that all symbols are external to the load module being compiled and thus cannot be optimized; this is the default.

    Usage:

    Use this option to control which symbols' accesses may be optimized. Knowledge of the shared libraries used by an application, or the exported interface of a shared library is required.

    Use +O[no]extern at optimization levels 0, 1, 2, 3, or 4. The default is +Oextern with no name list.

    This option is deprecated and its use is not recommended.

    +O[no]fltacc Command Line Option Syntax

    +O[no]fltacc
    

    Description:

    Disable [enable] floating-point optimizations that can result in numerical differences. +Onofltacc also generates Fused Multiply-Add (FMA) instructions, as does compiling your program at optimization level 2 or higher. FMA instructions can improve performance of floating-point applications.

    If you specify neither +Ofltacc nor +Onofltacc, less optimization is performed than for +Onofltacc. If you specify neither option at optimization level 2 or higher, the optimizer generates FMA instructions but does not perform any expression-reordering optimizations.

    Specifying +Ofltacc insures the same result as in unoptimized code (+O0).

    Usage

    The +Onofltacc option allows the compiler to make transformations which are algebraically correct, but which may slightly affect the result of computations due to the inherent imperfection of computer floating-point arithmetic. For many programs, the results obtained under +Onofltacc are adequately similar to those obtained without the optimization.

    For applications in which roundoff error has been carefully studied, and the order of computation carefully crafted to control error, +Onofltacc may be unsatisfactory. To insure the same result as in unoptimized code, use +Ofltacc.

    Use +Onofltacc at optimization levels 2, 3, or 4. The default is to leave this option unspecified.

    Example:

    +Onofltacc allows the compiler to substitute division by a multiplication using the reciprocal. For example, the following code

    for (int j=1;j<5;j++)
        a[j] = b[j] / x;
    

    is transformed as follows (note that x is invariant in the loop):

    x_inv = 1.0/x;
    for (int j=1;j<5;j++)
        a[j] = b[j] * x_inv;
    

    Since multiplication is considerably faster than division, the optimized program runs faster.

    +Ofrequently_called Command Line Option Syntax

    +Ofrequently_called=function1[,function2...]
    

    Description:

    The named functions are assumed to be frequently called. This option overrides any information in a profile database.
    +Ofrequently_called:filename
    

    Description:

    The file indicated by filename contains a list of functions, separated by spaces or newlines. These functions are assumed to be frequently called. This option overrides any information in a profile database.

    +O[no]initcheck Command Line Option Syntax

    +O[no]initcheck
    

    Description:

    The initialization checking feature of the optimizer has three possible states: on, off, or unspecified.

    Use +Oinitcheck to look for program variables that may not be initialized.

    Use +Oinitcheck at any optimization level and +Onoinitcheck at optimization levels 2, 3, or 4.

    +O[no]inline Command Line Option Syntax

    +O[no]inline
    

    Description:

    The +Oinline option indicates that any function can be inlined by the optimizer. +Onoinline disables inlining of functions by the optimizer. (This option does not affect functions inlined at the source code level.

    Use +Onoinline at optimization levels 3 or 4. The default is +Onoinline at optimization levels 1 and 2 and +Oinline at levels 3 and 4.

    Usage

    +O[no]inline=function1{,function2...]
    Enable [disable] optimizer inlining for the named functions.

    +O[no]inline=filename
    The file indicated by filename should contain a list of function names, separated by commas or newlines. Optimization is enabled [disabled] for the named functions.

    See Also:

    +Oinlinebudget Command Line Option Syntax

    +Oinlinebudget=n
    

    Description:

    The +Oinlinebudget option controls the aggressiveness of inlining according to the value you specify for n where n is an integer in the range 1 - 1000000 that specifies the level of aggressiveness, as follows:

    = 100
    Default level of inlining.

    > 100
    More aggressive inlining. The optimizer is less restricted by compilation time and code size when searching for eligible routines to inline.

    2 - 99
    Less aggressive inlining. The optimizer gives more weight to compilation time and code size when determining whether to inline.

    = 1
    Only inline if it reduces code size.

    The +Onolimit and +Osize options also affect inlining. Specifying the +Onolimit option has the same effect as specifying +Oinlinebudget=200. The +Osize option has the same effect as +Oinlinebudget=1.

    Note, however, that the +Oinlinebudget option takes precedence over both of these options. This means that you can override the effect of +Onolimit or +Osize option on inlining by specifying the +Oinlinebudget option on the same compile line.

    Use this option at optimization level 3 or higher. The default is +Oinlinebudget=100.

    For More Information:

    See also the +O[no]inline option.

    +Olevel=name1[,name2,...,nameN] Command Line Option Syntax

    +Olevel=name1[,name2,...,nameN]
    

    Description:

    This option lowers optimization to the specified level for one or more named functions. level can be 0, 1, 2, 3, or 4. The name parameters are names of functions in the module being compiled. Use this option when one or more functions do not optimize well or properly. This option must be used with a basic +Olevel or -O option.

    This option works as does the OPT_LEVEL pragma. The option overrides the pragma for the specified functions. As with the pragma, you can only lower the level of optimization; you cannot raise it above the level specified by a basic +Olevel or -O option. To avoid confusion, it is best to use either this option or the OPT_LEVEL pragma rather than both.

    You can use this option at optimization levels 1, 2, 3, and 4. The default is to optimize all functions at the level specified by the basic +Olevel or -O option.

    Examples

    The following command optimizes all functions at level 3, except for the functions myfunc1 and myfunc2, which it optimizes at level 1.
    aCC +O3 +O1=myfunc1,myfunc2 funcs.c main.c
    
    The following command optimizes all functions at level 2, except for the functions myfunc1 and myfunc2, which it optimizes at level 0.
    aCC -O +O0=myfunc1,myfunc2 funcs.c main.c
    

    +O[no]looptransform Command Line Option Syntax

    +O[no]looptransform
    

    Description:

    The +O[no]looptransform option enables [disables] transformation of eligible loops for improved cache performance. The most important transformation is the reordering of nested loops to make the inner loop unit stride, resulting in fewer cache misses.

    The default is +Olooptransform at optimization levels 3 and 4. You cannot use the option at levels 0-2.

    +O[no]moveflops Command Line Option Syntax

    +O[no]moveflops
    

    Description:

    The +Omoveflops option allows moving conditional floating-point instructions out of loops. The behavior of floating-point error handling may be altered by this option.

    This option also allows you to enable or disable replacing integer divide by a floating-point multiply. This may cause SIGFPE if IEEE inexact is enabled (+FPI).

    Usage:

    Use +Onomoveflops if floating-point traps are enabled and you do not want the behavior of floating-point errors to be altered by the relocation of floating-point instructions.

    Use +Onomoveflops at optimization levels 2, 3, and 4. The default is +Omoveflops.

    This option is deprecated and its use is not recommended.

    +opts Command Line Option Syntax

    +opts filename
    

    Description:

    The file indicated by filename contains a list of options that are processed as if they had been specified on the command line at the point of the +opts option.

    +O[no]parminit Command Line Option Syntax

    +O[no]parminit
    

    Description:

    Enables [disables] automatic initialization to zero of unspecified function parameters at call sites. This is useful in preventing NaT values in parameter registers. The default is +Onoparminit.

    +O[no]parmsoverlap Command Line Option Syntax

    +O[no]parmsoverlap
    

    Description:

    The +Oparmsoverlap option optimizes with the assumption that the actual arguments of function calls overlap in memory.

    Use +Onoparmsoverlap if C++ programs have been literally translated from FORTRAN programs.

    Use +Onoparmsoverlap at optimization levels 2, 3, and 4. The default is +Oparmsoverlap.

    +O[no]procelim Command Line Option Syntax

    +O[no]procelim
    

    Description:

    Enable [or disable] the elimination of dead procedure code.

    Used when linking an executable file, +Oprocelim removes functions not referenced by the application. Used when building a shared library, +Oprocelim removes functions not exported and not referenced from within the shared library. This may be especially useful when functions have been inlined.

    Note that any function having symbolic debug information associated with it is not removed.

    The default is +Onoprocelim unless -g is used.

    Use +O[no]procelim at any optimization level.

    +O[no]promote_indirect_calls Command Line Option Syntax

    +O[no]promote_indirect_calls
    

    Description:

    This option uses profile data from profile-based optimization and other information to determine the most likely target of indirect calls and promotes them to direct calls. Indirect calls occur with pointers to functions and virtual calls.

    In all cases the optimized code tests to make sure the direct call is being taken and if not, executes the indirect call. If +Oinline is in effect, the optimizer may also inline the promoted calls. +Opromote_indirect_calls is only effective with profile-based optimization.

    NOTE: The optimizer tries to determine the most likely target of indirect calls. If the profile data is incomplete or ambiguous, the optimizer may not select the best target. If this happens, your code's performance may decrease.

    This option can be used at optimization levels 3 and 4. At +O3, it is only effective if indirect calls from functions within a file are mostly to target functions within the same file. This is because +O3 optimizes only within a file whereas, +O4 optimizes across files.

    The default is +Onopromote_indirect_calls.

    +Orarely_called Command Line Option Syntax

    +Orarely_called=function1[,function2...]
    

    Description:

    The named functions are assumed to be rarely called. This option overrides any information in a profile database.
    +Orarely_called:filename
    

    Description:

    The file indicated by filename contains a list of functions, separated by spaces or newlines. These functions are assumed to be rarely called. This option overrides any information in a profile database.

    +O[no]recovery Command Line Option Syntax

    +O[no]recovery
    

    Description:

    Generate [do not generate] recovery code for control speculation. The default is +Orecovery. For code that writes to uncacheable memory that may not be properly identified as volatile, the +Orecovery option reduces the risk of incorrect behavior.

    +Oshortdata Command Line Option Syntax

    +Oshortdata[=size]
    

    Description:

    All objects of [size] bytes or smaller are placed in the short data area, and references to such data assume it resides in the short data area. Valid numbers are zero or a decimal number between 8 and 4,194,304 (4MB). If no size is specified, all data is placed in the short data area. If size = zero, no data is placed in the short data area, all data references use long offsets, and thread-local storage is not supported. The default is +Oshortdata=8.

    +Ostore_ordering Command Line Option Syntax

    +O[no]store_ordering
    

    Description:

    Preserve [do not preserve] the original program order for stores to memory that is visible to multiple threads. This does not imply strong ordering. The default is +Onostore_ordering.

    Profile-Based Optimization Options

    Profile-based optimization is a set of performance-improving code transformations based on the run-time characteristics of your application.

    +dfname
    Specifies the profile database to use with profile-based optimization.
    +I
    Prepares the object code for profile-based optimization data collection.
    +Oprofile
    Prepares the object code for profile-based optimization data collection.
    +P
    Performs profile-based optimization.

    For More Information:

    For more information on performing profile-based optimization, see:

    +dfname Command Line Option Syntax

    +dfname
    

    Description:

    Specifies the path name of the profile database to use with profile-based optimization. This option can be used with the +P command line option.

    The profile database by default is named flow.data. This file stores profile information for one or more executables. Use +df when the flow.data file has been renamed or is in a different directory than where you are linking.

    You can also use the FLOW_DATA environment variable to specify a different path and file name for the profile database file. The +dfname command line option takes precedence over the FLOW_DATA environment variable.

    NOTE: The +dfname option cannot be used to redirect the instrumentation output (with the +I option). It is only compatible with the +P option.

    Example:

    aCC +P +dfpbo.data prog.o -o myapp
    

    Relinks the object file prog.o, optimizes using the run-time profile data in the file pbo.data, and puts the executable code in the file myapp.

    name Parameter
    This parameter specifies the path name of the profile database to use with profile-based optimization.

    +Oprofile Command Line Option Syntax

    +Oprofile=[use|collect]
    

    Description:

    Instructs the compiler to instrument the object code for collecting run-time profile data. The profiling information can then be used by the linker to perform profile-based optimization. Code generation and optimization phases are delayed until link time by this option.

    +Oprofile=collect is equivalent to +I.

    +Oprofile=use[filename] causes the compiler to look for a profile database file. Overrides the FLOW_DATA environment variable.

    After compiling and linking with +Oprofile, run the resultant program using representative input data to collect execution profile data. Finally, relink with the +P option to perform profile-based optimization.

    Profile data is stored in flow.data by default. See the +dfname option for information on controlling the name and location of this data file.

    The +Oprofile option is incompatible with the -G, +P, and -S options. And it is incompatible with -g0 and -g1 if used to compile.

    Example:

    aCC +Oprofile -O -c prog.C
    aCC +Oprofile -O -o prog.pbo prog.o
    

    Compiles prog.C with optimization, prepares the object code for data collection, and creates the executable file prog.pbo. Running prog.pbo collects run-time information in the file flow.data in preparation for optimization with +P.

    +I Command Line Option Syntax

    +I
    

    Description:

    Instructs the compiler to instrument the object code for collecting run-time profile data. The profiling information can then be used by the linker to perform profile-based optimization. Code generation and optimization phases are delayed until link time by this option. Equivalent to +Oprofile=collect.

    After compiling and linking with +I, run the resultant program using representative input data to collect execution profile data. Finally, relink with the +P option to perform profile-based optimization.

    Profile data is stored in flow.data by default. See the +dfname option for information on controlling the name and location of this data file.

    The +I option is incompatible with the -G, +P, and -S options. And it is incompatible with -g0 and -g1 if used to compile.

    Example:

    aCC +I -O -c prog.C
    aCC +I -O -o prog.pbo prog.o
    

    Compiles prog.C with optimization, prepares the object code for data collection, and creates the executable file prog.pbo. Running prog.pbo collects run-time information in the file flow.data in preparation for optimization with +P.

    +P Command Line Option Syntax

    +P
    

    Description:

    Directs the compiler to use profile information to guide code generation and profile-based optimization. The compiler generates intermediate compiler code instead of compiled object code. Code generation is done at link time.

    The +P option does not affect the default optimization level, or the optimization level specified by the +O1, +O2, +O3, or +O4 options.

    NOTE: Source files that are compiled with the +I option do not need to be recompiled with +P in order to use profile-based optimization. You only need to relink the object files with the +P option after running the instrumented version of the program.

    The +P option is incompatible with the +I and -S options. And it is incompatible -g0 and -g1 if used to compile.

    Example:

    aCC +P -o myapp prog.o
    

    Relinks the object file prog.o and optimizes using the run-time profile data.

    Other Options that Affect Optimization

    +DS
    Perform instruction scheduling tuned for a particular implementation of the PA-RISC architecture.

    +O[no]info Command Line Option Syntax

    +O[no]info
    

    Description:

    +Oinfo displays informational messages about the optimization process. This option may be helpful in understanding what optimizations are occurring.

    You can use the option at levels 0-4. The default is +Onoinfo at levels 0-4.


    Performance

    HP aC++ provides a variety of options to help improve build and run-time performance. Choose from the following:

    -fast
    Select a set of options for optimum execution speed for reasonable build times.
    +inline_level [i]num
    Controls how C++ inlining hints influence HP aC++. Also allows implicit inlining of small functions that are not explicitly tagged with the inline keyword.
    +[no]objdebug
    Generate debug information in object files and not in the executable.
    +DSmodel
    Perform instruction scheduling tuned for a particular implementation of the PA-RISC architecture.
    Optimization Options
    Select the appropriate options to improve program execution speed.

    -fast Command Line Option Syntax

    -fast
    

    Description:

    The -fast option selects a combination of optimization options for optimum execution speed for reasonable build times. Currently chosen options are: You can override any of the options in -fast by specifying a subsequent option after it.

    Usage:

    This option may aid in porting C++ applications compiled on other UNIX operating systems to HP-UX.

    NOTE: Do not use this option for programs that depend on IEEE standard floating-point denormalized numbers. Otherwise, different numerical results may occur.


    Porting

    Use the following options as necessary when porting your code from other operating environments to HP-UX.

    -fast
    Select a set of options for optimum execution speed for reasonable build times.
    +uc
    Treat an unqualified (plain) char data type as unsigned char.

    +uc Command Line Option Syntax

    +uc
    

    Description:

    By default, HP aC++ treats all unqualified char data types as signed char. Specifying +uc causes an unqualified (plain) char data type to be treated as unsigned char. (Overloading and mangling are unchanged.)

    Usage:

    Use this option to help in porting applications from environments where an unqualified (plain) char type is treated as unsigned char.

    NOTE: Since all unqualified char types in the compilation unit will be affected by this option (including those headers that define external and system interfaces) it is necessary to compile the interfaces used in a single program uniformly.


    Preprocessor Options

    The following options are accepted by the preprocessor:

    -Dname
    Defines name to the preprocessor.
    -E
    Runs only the preprocessor and sends output to stdout.
    +m[d]
    Output quote enclosed (" ") make(1) dependency files to stdout or to a .d file.
    +M[d]
    Output both quote enclosed and angle bracket enclosed (< >) make(1) dependency files to stdout or to a .d file.
    -P
    Runs only the preprocessor and sends output to a corresponding .i file.
    -.suffix
    Sends preprocessed output to the corresponding output file ending with .suffix.
    -Uname
    Undefines name in the preprocessor.

    See Also:

    -Dname Command Line Option Syntax

    -Dname[=def]
    
    name is the symbol name that is defined for the preprocessor.

    def is the definition of the symbol name (name).

    Description:

    Defines a symbol name (name) to the preprocessor, as if defined by the preprocessing directive #define.

    If no definition (def) is given, the name is defined as "1".

    Example:

    aCC -DDEBUGFLAG file.C
    

    Defines the preprocessor symbol DEBUGFLAG and gives it the value 1. Following is a program that uses this symbol.

    #include <iostream.h>
    void main(){
    int i, j;
    #ifdef DEBUGFLAG
    int call_count=0;
    #endif
      ...
    }
    

    For More Information: