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:


Options to Control Code Generation

These options allow you to control what kind of code HP aC++ generates.
-c
Compile to relocatable object file without linking.
+DAarchitecture
Generate object code for a particular version of the PA-RISC architecture. Also specifie which version of the HP-UX math library to use.
Set the target operating system for the compiler.
+DSmodel
Perform instruction scheduling tuned for a particular implementation of the PA-RISC architecture.
+k
Generate code for programs that use a large number of global data items in shared libraries.
-S
Compile to assembly language without linking.
+tmtarget
Compile code for optimization with a specific machine architecture.
+z
Generate position-independent code (PIC) to go into a shared library.
+Z
Generate position-independent code (PIC) to go into a shared library.

-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.

+DAarchitecture Command Line Option Syntax

+DAarchitecture
architecture can be one of the following: NOTE: See the /opt/langtools/lib/sched.models file for a list of model numbers and their PA-RISC architecture designations.

Description:

Generates object code for a particular version of the PA-RISC architecture. Also specifies which version of the HP-UX math library to link in when you have specified -lm. (See the HP-UX Floating-Point Guide for more information about using math libraries.)

NOTE: Object code generated for PA-RISC 2.0 will not execute on PA-RISC 1.1 systems.

To generate code compatible across PA-RISC 1.1 and 2.0 workstations and servers, use the +DAportable option.

For best performance use +DA with the model number or architecture where you plan to execute the program.

If you do not specify a +DA option, the default code generation is based on that of the system on which you compile.

If you specify neither a +DA nor a +DS option, default instruction scheduling is based on that of the system on which you compile. If you do specify a +DA option and do not specify a +DS option, default instruction scheduling is based on what you specify in +DA, and not based on that of the system on which you compile.

For example, specify +DA1.1 and do not specify +DS, and instruction scheduling will be for 1.1. Specify +DAportable and do not specify +DS, and instruction scheduling will be for 1.1. (+DAportable is currently equivalent to +DA1.1.)

Examples:

The following examples generate code for various architectures, as noted:

For More Information:

Compiling for Different Versions of the PA-RISC Architecture

The instruction set on PA-RISC 2.0 is a superset of the instruction set on PA-RISC 1.1. Code generated for HP 9000 PA-RISC 1.1 systems will run on HP 9000 PA-RISC 2.0 systems, though possibly less efficiently than if it were specifically generated for PA-RISC 2.0.

Code generated for PA-RISC 2.0 will not run on PA-RISC 1.1 systems.

Using +DA to Generate Code for a Specific Version of PA-RISC

When you use the +DA 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.

+DSmodel Command Line Option Syntax

+DSmodel
model can be either a model number of an HP 9000 system (such as 725, 890, or G40), PA-RISC architecture designation 1.1 or 2.0, or one of the PA-RISC processor names such as PA7000, PA7100, PA7100LC, or PA8000. See the file /opt/langtools/lib/sched.models for model numbers and processor names.

Description:

Performs instruction scheduling tuned for a particular implementation of the PA-RISC architecture.

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

If you specify neither a +DA nor a +DS option, default instruction scheduling is based on that of the system on which you compile. If you do specify a +DA option and do not specify a +DS option, default instruction scheduling is based on what you specify in +DA, and not based on that of the system on which you compile.

For example, specify +DA1.1 and do not specify +DS, and instruction scheduling will be for 1.1. Specify +DAportable and do not specify +DS, and instruction scheduling will be for 1.1. (+DAportable is currently equivalent to +DA1.1.)

If you plan to run your program on both PA-RISC 1.1 and 2.0 systems, use the +DS2.0 designation.

Examples:

+DS720
Performs instruction scheduling tuned for one implementation of PA-RISC 1.1.
+DS745
Performs instruction scheduling for another implementation of PA-RISC 1.1.
+DSPA8000
Performs instruction scheduling for systems based on the PA-RISC 8000 processor.

For More Information:

Using +DS to Specify Instruction Scheduling

Instruction scheduling is different on different implementations of PA-RISC 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.

By default, the compiler performs scheduling tuned for the system on which you are compiling, or, if specified, tuned for the setting of the +DA option. Use the +DS option to change this default behavior and to specify instruction scheduling tuned to a particular implementation of PA-RISC. For example, to specify instruction scheduling for the model 867, use +DS867. To specify instruction scheduling for the PA-RISC 8000 processor, use +DSPA8000. See the file /opt/langtools/lib/sched.models for model numbers and processor names.

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.

+k Command Line Option Syntax

+k

Description:

By default, the HP aC++ compiler generates short-displacement code sequences for programs that reference global data in shared libraries. For nearly all programs this is sufficient.

If your program references a large amount of global data in shared libraries, the default code generation for referencing that global data may not be sufficient. If this is the case, when you link your program the linker gives an error message indicating that you need to recompile with the +k option. The +k option generates long-displacement code sequences so a program can reference large amounts of global data in shared libraries. Use +k only when the linker generates a message indicating you need to do so.

Example:

aCC +k prog.C mylib.sl

Compiles prog.C, generates code for accessing a large number of global data items in the shared library mylib.sl, and links with mylib.sl.

+tmtarget Command Line Option Syntax

+tmtarget

Description:

+tm target specifies the target machine architecture for which compilation is to be performed. Using this option causes the compiler to perform architecture-specific optimizations. target takes one of the following values: Using the +tm target option implies +DAarchitecture and +DSmodel settings as described in the following table.

specified target value +DAarchitecture implied +DSmodel implied
K7200 1.1 1.1
K8000 2.0 2.0
V2200 2.0 2.0

NOTE: If you specify +DA or +DS on the aCC command line, your setting takes precedence over the setting implied by +tm target.

Usage:

Use +tm target at optimization levels 0, 1, 2, 3, and 4. The default target value corresponds to the machine on which you invoke the compiler.

-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.

CAUTION: The -S option is informational only. Generated output is not meant 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.


Data Alignment and Storage

+u
Allows pointers to access non-natively aligned data.

+u Command Line Option Syntax

+unum

Description

The +u option allows pointers to access non-natively aligned data. This option alters the way that the compiler accesses dereferenced data. Use of this option may reduce the efficiency of generated code. num can be specified as:

1
Assume single byte alignment. Dereferences are performed with a series of single-byte loads and stores.
2
Dereferences are performed with a series of two-byte loads and stores.
4
Dereferences are performed with a series of four-byte loads and stores.

Example:

aCC +u1 app.C

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 lists the sizes and alignments of HP aC++ data types:

Data Type         Size (bytes)      Alignment

bool 1 1-byte

char, unsigned char, 1 1-byte signed char

wchar_t 2 2-byte

short, unsigned short, 2 2-byte signed short

int, unsigned int 4 4-byte

long, unsigned long 4 4-byte

float 4 4-byte

double 8 8-byte

long double 16 8-byte

long long, 64 8-byte unsigned long long

enum 4 4-byte

arrays Size and alignment of array element type.

struct (*) 1-, 2-, 4- or 8-byte (*)

union (*) 1-, 2-, 4- or 8-byte (*)

bit-fields Size and alignment of declared type.

pointer 4 4-byte

(*) 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 or the HP/DDE Debugger.

+d
Disables all inlining of functions.
-g
Generate minimal information for debugging.
-g0
Generate full information for debugging.
-g1
Generate minimal information for debugging.

+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.


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.
+Wargs
Selectively suppress compiler warnings.
+Weargs
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.

+Wargs Command Line Option Syntax

+Warg1[,arg2,..argn]

Description

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

Example:

aCC +W600 app.C

+Weargs Command Line Option Syntax

+Wearg1[,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 +We600,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 elicit an error.

Note that if your application throws no exceptions, code compiled with and without +noeh can be mixed freely. However, the mixing of code compiled with and without +noeh in an application which throws exceptions is unsupported.

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:

This option enables 64-bit integer data type support, allowing you to declare long long and unsigned long long data types.

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

If you use the -ext option, use 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; }


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 /opt/aCC/include/SC file.C

This example directs HP aC++ to search in the directory /opt/aCC/include/SC 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 shell notation)

setenv DISPLAY YourDisplayAddress      (csh shell notation)

Examples:

To invoke the online guide:
aCC +help

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

export BROWSER=AlternateBrowserLocation
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_levelnum
Controls how C++ inlining hints influence HP aC++.

See Also:

+inline_levelnum Command Line Option Syntax

+inline_levelnum 

Description

This option controls how C++ inlining hints influence HP aC++. Specify num as 0, 1, 2, or 3.

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.
+A
Links with archive libraries.
-b
Creates a shared library.
+k
Generates code for programs that use a large number of global data items in shared libraries.
-lname
Specifies a library for the linker to search.
-Ldirectory
Specifies a directory for the linker to search for libraries.
-Wx,args
One use of -W is to specify linking of shared or archive libraries.
+z
Generates position-independent code (PIC) to go into a shared library.
+Z
Generates position-independent code (PIC) to go into a shared library.

See Also:

+A Command Line Option Syntax

+A

Description:

Causes the linker to link with archive libraries rather than shared libraries and creates a completely archived executable.

The -a,archive linker option also links archive libraries but it links the shared library /usr/lib/libdld.sl. +A links in /opt/aCC/lib/cxxshl.o instead of /usr/lib/libdld.sl.

Example:

aCC +A file.o -lm
Links file.o and links in the archived version of the math library, /lib/libm.a, rather than the shared version, /lib/libm.sl, and does not link in /usr/lib/libdld.sl.

See Also:

-b Command Line Option Syntax

-b

Description:

Creates a shared library rather than an executable file.

The object files must have been created with the +z or +Z option to generate position-independent code (PIC).

Example:

aCC -b utils.o -o utils.sl

Links utils.o (which must have been created using the +z option) and creates the shared library utils.sl.

For More Information:

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

-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 (.sl) or the archive library (.a) depends on the value of the -a linker option or the +A 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/libnumeric.sl.

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.

The default search path is the directory /opt/aCC/lib.

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 /opt/aCC/lib and /project/libs for any libraries that prog.C uses (in this case, mylib1 and mylib2).

See Also:

+z Command Line Option Syntax

+z

Description:

Causes the compiler to generate position-independent code (PIC), necessary for building a shared library.

Use -b to create a shared library.

+z is similar to the +Z option. Use +z unless the linker generates an error message indicating that you should use +Z.

The -G option is ignored if either +z or +Z is used.

Example:

aCC -c +z utils.C

Compiles utils.C and generates position-independent code in utils.o. utils.o can be placed into a shared library with the -b option.

For More Information:

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

+Z Command Line Option Syntax

+Z

Description:

Causes the compiler to generate position-independent code (PIC), necessary for building shared libraries.

Use -b to create a shared library.

+Z is the same as the +z option except that it allows for more imported symbols than does +z. Use the +Z option only if errors are generated when you use +z.

The -G option is ignored if either +z or +Z is used.


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.

In addition, you can use the -Wl,args compiler option to specify any linker option on the compiler command line.

For More Information:

For more information on linker options, see the ld(1) man page or the HP-UX Reference Manual.

-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 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 -.Pfile prog.C

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


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:

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.
+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:

+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.

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 +04 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.

    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

    +ESfic
    Replace millicode calls with inline fast indirect calls.
    +ESsfc
    Replace millicode calls with inline code when performing simple function pointer comparisons.
    +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.

    +ESfic Command Line Option Syntax

    Syntax

    +ESfic
    

    Description:

    Replaces millicode calls with inline fast indirect calls. The +ESfic compiler option affects how function pointers are dereferenced in generated code. The default is to generate low-level millicode calls for function pointer calls.

    The +ESfic option generates code that calls function pointers directly, by branching through them.

    NOTE: The +ESfic option should only be used in an environment where there are no dependencies on shared libraries. The application must be linked with archive libraries only. Using this option can improve run-time performance.

    +ESsfc Command Line Option Syntax

    Syntax

    +ESsfc
    

    Description:

    Replaces millicode calls with inline code when performing simple function pointer comparisons. The +ESsfc compiler option affects how function pointers are compared in generated code. The default is to generate low-level millicode calls for function pointer comparisons.

    The +ESsfc option generates code that compares function pointers directly, as if they were simple integers.

    NOTE: The +ESsfc option should only be used in an environment where there are no dependencies on shared libraries. The application must be linked with archive libraries only. Using this option can improve run-time performance.

    Example:

    Following is an example of a code fragment that performs function pointer comparisons:

    int (*g)( );
    int (*f)( );
    int foo ( );
    {
        . . .
    }
        . . .
      if (f == g)
        . . .
      if (f == foo)
        . . .
      if (f == SIG_ERR) /* SIG_ERR is defined in signal.h */
        . . .
    

    +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]dataprefetch
    Enable [disable] optimizations to generate data prefetch instructions for data structures referenced within innermost loops.
    +O[no]entrysched
    Perform [do not perform] instruction scheduling on a subprogram's entry and exit sequences.
    +O[no]failsafe
    Enable [disable] fail-safe optimization.
    +O[no]fastaccess
    Enable [disable] fast access to global data items.
    +O[no]fltacc
    Disable [enable] all optimizations that cause imprecise floating-point results.
    +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.
    +O[no]libcalls
    Use [do not use] millicode routines instead of certain math library calls.
    +O[no]looptransform
    Transform [do not transform] eligible loops for improved cache performance.
    +O[no]loopunroll[=unroll factor]
    Enable [disable] loop unrolling.
    +O[no]moveflops
    Move [do not move] conditional floating-point instructions out of loops.
    +O[no]parmsoverlap
    Assume [do not assume] that arguments of function calls overlap in memory.
    +O[no]pipeline
    Enable [disable] software pipelining.
    +O[no]procelim
    Enable [disable] elimination of unreferenced procedures.
    +O[no]regionsched
    Move [do not move] instructions across branches.
    +O[no]regreassoc
    Enable [disable] register reassociation.
    +O[no]signedpointers
    Optimize treating pointers as signed [unsigned] quantities.
    +O[no]volatile
    Assume all global variables are [not] volatile.

    +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). It is only available for PA-RISC 2.0 targets.

    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.

    +O[no]entrysched Command Line Option Syntax

    +O[no]entrysched
    

    Description:

    The +Oentrysched option optimizes instruction scheduling on a procedure's entry and exit sequences. Enabling this option can speed up an application. The option has undefined behavior for applications which handle asynchronous interrupts. The option affects unwinding in the entry and exit regions.

    At optimization level +O2 and higher (using dataflow information), save and restore operations become more efficient.

    This option can change the behavior of programs that perform error handling or that handle asynchronous interrupts. The behavior of setjmp() and longjmp() is not affected.

    Use +Oentrysched at optimization levels 2, 3, or 4. The default is +Onoentrysched.

    +O[no]failsafe Command Line Option Syntax

    +O[no]failsafe
    

    Description:

    The +Ofailsafe option allows compilations with internal optimization errors to continue by issuing a warning message and restarting the compilation at +O0.

    You can use +Onofailsafe at optimization levels 1, 2, 3, or 4 when you want the internal optimization errors to abort your build.

    The default is +Ofailsafe at levels 1, 2, 3, 4.

    +O[no]fastaccess Command Line Option Syntax

    +O[no]fastaccess
    

    Description:

    The +Ofastaccess option optimizes for fast access to global data items.

    Use +Ofastaccess to improve execution speed at the expense of longer compile times.

    Use +Ofastaccess at optimization levels 0, 1, 2, 3, or 4. The default is +Onofastaccess at optimization levels 0, 1, 2, and 3, and +Ofastaccess at optimization level 4.

    +O[no]fltacc Command Line Option Syntax

    +O[no]fltacc
    

    Description:

    The +Ofltacc option allows the compiler to make transformations which are algebraically correct, but which may affect the result of computations slightly due to the inherent imperfection of computer floating-point arithmetic. These transformations typically exceed those allowed by relevant language standards.

    For many programs, the results obtained under +Onofltacc are as valid as those obtained without the optimization. They may be slightly different, but not obviously better or worse. For applications in which roundoff error has been carefully studied, and the order of computation carefully crafted to control error, +Onofltacc may be unsatisfactory.

    Use +Onofltacc at optimization levels 2, 3, or 4. The default is +Ofltacc.

    CAUTION: The sophistication of this optimization is likely to change over time. You should review the performance of your code with subsequent releases of the HP aC++ compiler.

    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.

    +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.

    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.

    +O[no]libcalls Command Line Option Syntax

     
    +O[no]libcalls   
    

    Description:

    A number of math library functions are implemented in a special millicode library as well as in the standard math library. The millicode versions are up to 25 percent faster than the standard versions. However, they do not set errno and do not give an error message in the event of an exception.

    The +Olibcalls option provides access to millicode routines for the following math library calls:

    sin   cos   tan   atan2   pow   log10   asin   acos   atan   exp   log
    

    Use +Olibcalls to improve the performance of these library routines only when you do not want standard error checking. For example, you might use +Olibcalls with code that has already been debugged and runs without error.

    The default is +Onolibcalls.

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

    +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]loopunroll Command Line Option Syntax

    +O[no]loopunroll[=unroll factor]
    

    Description:

    The +Oloopunroll option turns on loop unrolling. When you use +Oloopunroll, you can also use the unroll factor to control the code expansion. The default unroll factor is 4, that is, four copies of the loop body. By experimenting with different factors, you may improve the performance of your program.

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

    +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.

    +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]pipeline Command Line Option Syntax

    +O[no]pipeline
    

    Description:

    The +Opipeline option enables software pipelining.

    Use +Onopipeline to conserve code space.

    Use +Onopipeline at optimization levels 2, 3, and 4. The default is +Onopipeline at optimization level 1 and +Opipeline at levels 2, 3, and 4.

    +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 at optimization levels 1 through 3 and +Oprocelim at level 4.

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

    +O[no]regionsched Command Line Option Syntax

    +O[no]regionsched
    

    Description:

    The +Oregionsched option applies aggressive scheduling techniques to move instructions across branches.

    NOTE: This option is incompatible with the -z option. Using this option with -z may cause a SIGSEGV error at run-time. 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.)

    Use +Oregionsched to improve application run-time speed.

    Use +Oregionsched at optimization levels 2, 3, and 4. The default is +Onoregionsched.

    +O[no]regreassoc Command Line Option Syntax

    +O[no]regreassoc
    

    Description:

    The +Onoregreassoc option turns off register reassociation.

    Use +Onoregreassoc to disable register reassociation if this optimization hinders application performance.

    Use +Onoregreassoc at optimization levels 2, 3, and 4. The default is +Oregreassoc.

    +O[no]signedpointers Command Line Option Syntax

    +O[no]signedpointers
    

    Description:

    The +Osignedpointers option performs optimizations related to treating pointers in Boolean comparisons (for example, <, <=, >, >=) as signed quantities. Applications that allocate shared memory and that compare a pointer to shared memory with a pointer to private memory may run incorrectly if this optimization is enabled.

    Use+Osignedpointers to improve application run-time speed.

    Use +Osignedpointers at optimization levels 2, 3, and 4. The default is +Onosignedpointers.

    +O[no]volatile Command Line Option Syntax

    +O[no]volatile
    

    Description:

    The +Ovolatile option implies that memory references to global variables are volatile and cannot be removed during optimization. The +Onovolatile option implies that all globals are not of volatile class. This means that references to global variables can be removed during optimization.

    Use this option to control the "volatile" semantics for all global variables.

    Use +Ovolatile at optimization levels 1, 2, 3, or 4. The default is +Onovolatile.

    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.
    +P
    Performs profile-based optimization.
    +pgmname
    Specifies the execution profile data to use with 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.

    +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.

    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 exception handling. To turn off exception handling, use the +noeh option.

    The +I option is incompatible with the -g0, -g1, -G, +P, and -S options.

    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 exception handling. To turn off exception handling, use the +noeh option.

    The +P option is incompatible with the +noeh, -g0, -g1, +I, and -S options.

    Example:

    aCC +P -o myapp prog.o
    

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

    +pgmname Command Line Option Syntax

    +pgmname
    

    Description:

    Specifies a program name to look up in the flow.data file to use with profile-based optimization and the +P option.

    The +pgmname option should be used when the name of the profiled executable differs from the name of the current executable specified by the -o option.

    Example:

    In the following example, the instrumented program file name is sample.inst. The optimized program file name is sample.opt. The +pgmname option is used to pass the instrumented program name, sample.inst, to the optimizer:

    aCC -c +I sample.C
    aCC -o sample.inst +I -O sample.o
    sample.inst < input.file1
    aCC -o sample.opt +P +pgm sample.inst sample.o
    

    +pgm name Parameter
    The name parameter is the instrumented executable program name that is used when performing profile-based optimization.

    Other Options that Affect Optimization

    +DA
    Generate object code for a particular version of the PA-RISC architecture. Also specifies which version of the HP-UX math library to use.
    +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.


    Precompiled Header Files

    Use the following options to create and use a precompiled header file.

    +hdr_create
    Create a precompiled header file.
    +hdr_use
    Compile using a precompiled header file.
    +hdr_v
    Lists verbose information when precompiling a header or when compiling a precompiled header file.

    See Also:

    +hdr_create Command Line Option Syntax

    +hdr_create
    

    Description:

    Creates a precompiled header file for subsequent use when compiling an application or a library with the +hdr_use option.

    You can reduce compilation time by precompiling common include (header) files into a precompiled header file.

    Example:

    aCC headers.C -c +hdr_create precomp 
    
    From headers.C, creates a precompiled header file named precomp.

    Note that the -c option is needed to suppress the link step.

    See Also:

    +hdr_use Command Line Option Syntax

    +hdr_use
    

    Description:

    Compiles a precompiled header file and its corresponding object (.o) file. These files must have been created by using the +hdr_create option.

    This is known as a load compile.

    Example:

    aCC main.C +hdr_use precomp 
    
    Compiles main.C, including a precompiled header file named precomp.

    See Also:

    +hdr_v Command Line Option Syntax

    +hdr_v
    

    Description:

    Provides verbose information when precompiling a header or when compiling a precompiled header file.

    Examples:

    aCC headers.C -c +hdr_create precomp +hdr_v 
    
    Creates a precompiled header file named precomp and displays what is going into the precompiled header file.

    aCC main.C +hdr_use precomp +hdr_v 
    
    Compiles main.C and displays what is being used from the precompiled header file.

    See Also:


    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:

    -E Command Line Option Syntax

    -E
    

    Description:

    Runs only the preprocessor on the named C++ files and sends the result to standard output (stdout).

    Unlike the -P option, the output of -E contains #line entries indicating the original file and line numbers.

    Redirecting Output From This Option

    Use the -.suffix option to redirect the output of this option.

    +m[d] Command Line Option Syntax

    +m[d]
    

    Description:

    Directs a list of the quote enclosed (" ") header files upon which your source code depends to stdout. The list is in a format accepted by the make(1) command.

    If +md is specified, the list is directed to a .d file. The .d file name prefix is the same as that of the object file. The .d file is created in the same directory as the object file.

    Usage:

    CAUTION: Use +md when you also specify the -E or -P option, otherwise the two outputs will be intermixed.

    Examples:

    command line specified .d file name .d file location
    aCC -c +m a.C none output to stdout
    aCC -c -E -.i +md a.C a.d current directory
    aCC -c -P +md a.C -o b.o b.d current directory
    aCC -c -P +md a.C -o /tmp/c c.d /tmp directory

    +M[d] Command Line Option Syntax

    +M[d]
    

    Description:

    Directs a list of both the quote enclosed (" ") and angle bracket enclosed (< >) header files upon which your source code depends to stdout. The list is in a format accepted by the make(1) command.

    If +Md is specified, the list is directed to a .d file. The .d file name prefix is the same as that of the object file. The .d file is created in the same directory as the object file.

    Usage:

    CAUTION: Use +Md when you also specify the -E or -P option, otherwise the two outputs will be intermixed.

    Examples:

    command line specified .d file name .d file location
    aCC -c +M a.C none output to stdout
    aCC -c -E -.i +Md a.C a.d current directory
    aCC -c -P +Md a.C -o b.o b.d current directory
    aCC -c -P +Md a.C -o /tmp/c c.d /tmp directory

    -P Command Line Option Syntax

    -P
    

    Description:

    Only preprocesses the files named on the command line without invoking further phases. Leaves the result in corresponding files with the suffix .i.

    Example:

    aCC -P prog.C
    
    Preprocesses the file prog.C leaving the output in the file prog.i. Does not compile the program.

    For More Information:

    -Uname Command Line Option Syntax

    -Uname
    
    name is the symbol name whose definition is removed from the preprocessor.

    Description:

    Undefines any name that has initially been defined by the preprocessing stage of compilation.

    A name can be a definition set by HP aC++; these are displayed when you specify the -v option. Or a name can be a definition you have specified with the -D option on the aCC command line.

    The -D option has lower precedence than the -U option. Thus, if the same name is used in both a -U option and a -D option, the name is undefined regardless of the order of the options on the command line.

    For More Information:


    Option for Profiling Your Code with gprof

    -G Command Line Option Syntax

    -G
    

    Description:

    Prepares the object file for use with gprof (to get an execution profile).

    Example:

    aCC -G file.C
    
    Compiles file.C and creates the executable file a.out instrumented for use with gprof.

    For More Information:

    Refer to the man page for gprof(1). (If you see the message "Man page could not be formatted," ensure the man page is installed.)

    Standards Related Options

    The following options related to the ANSI/ISO C++ International Standard are accepted by the compiler.

    -Wc,-koenig_lookup,[on][off]
    Enable or disable argument-dependent lookup rules ("Koenig lookup").

    Argument-dependent Lookup Rules Command Line Option Syntax

    -Wc,-koenig_lookup,[on]
                       [off]
    

    Description:

    This option enables or disables argument-dependent lookup rules (sometimes called "Koenig lookup"). It causes functions to be looked up in the namespaces and classes associated with the types of the function-call argument.

    Example:

    In the following example, if the option is not enabled (the current default), the call in main() does not consider declaration (1) and selects (2). With the option enabled, both declarations are seen, and in this case overload resolution will select (1).
    namespace N {
       struct S {};
       void f(S const&, int);  // (1)
    }
    
    void f(N::S const&, long); // (2)
    
    int main() {
       N::S x;
       f(x, 1);
    }
    

    For More Information:


    Subprocesses of the Compiler

    These options allow you to substitute your own processes in place of the default HP aC++ subprocesses, or pass options to HP aC++ subprocesses.

    -tx,name
    Substitutes name in place of subprocess x.
    -Wx,args
    Passes the option arg to subprocess x of the HP aC++ compiling system.

    -tx,name Command Line Option Syntax

    -tx,name
    

    Description:

    Substitutes or inserts subprocess x using name.

    This option works in two modes:

    1. If x is a single identifier, name represents the full path name of the new subprocess.
    2. If x is a set of identifiers, name represents a prefix to which the standard suffixes are concatenated to construct the full path names of the new subprocesses.

      Example:

      aCC -ta,/users/sjs/myasmb file.s
      
      Invokes the assembler /users/sjs/myasmb instead of the default assembler /usr/ccs/bin/as to assemble and link file.s.

      For More Information:

      More Examples of -t

      Substituting for c++filt

      aCC -tf,/new/bin/c++filt file.C
      
      Compiles file.C and specifies that /new/bin/c++filt should be used rather than the default /opt/aCC/bin/c++filt.

      Substituting for ctcom

      aCC -tC,/users/proj/ctcom file.C
      
      Compiles file.C and specifies that /users/proj/ctcom should be used instead of the default /opt/aCC/lbin/ctcom.

      Substituting for All Subprocesses

      aCC -tx,/new/&driver; file.C
      
      Compiles file.C and specifies that the characters /new/aCC should be used as a prefix to all the subprocesses of HP aC++ For example, /new/aCC/ctcom runs rather than the default /opt/aCC/lbin/ctcom.

      x Parameter
      x is one or more identifiers indicating the subprocess or subprocesses. The value of x can be one or more of the following:

      a
      Assembler (standard suffix is as).
      b
      C compiler driver (cc), used to invoke the assembler.
      C (upper case)
      HP aC++ compiler (standard suffix is ctcom).
      f
      Filter tool (c++filt).
      l
      Linker (standard suffix is ld).
      u
      Code generator when using +O4 or performing profile-based optimization (standard suffix is ucomp).
      x
      All subprocesses.

      name Parameter
      This parameter is either the full path name of the executable file that will be run, or a prefix that will be concatenated to the default path name.

      If x is a single identifier, name represents the full path name of the new subprocess. If x is a set of identifiers, name represents a prefix to which the standard suffixes are concatenated to construct the full path names of the new subprocesses.

      -Wx,args Command Line Option Syntax

      -Wx,arg1[,arg2,..,argn]
      

      Description:

      Passes the arguments arg1 through argn to the subprocess x of the compilation. The arguments are of the form:

      -argoption[,argvalue]
      

      Example:

      aCC -Wl,-v file.C
      
      Compiles file.C and passes the option -v to the linker.

      For More Information:

      More Examples of -W

      Passing Options to the Linker with -W

      aCC file.o -Wl,-a,archive -lm
      
      Links file.o and passes the option -a archive to the linker, indicating that the archive version of the math library (indicated by -lm) and all other driver supplied libraries should be used rather than the default shared library.

      Passing Multiple Options to the Linker with -W

      aCC -Wl,-a,archive,-m,-v file.o -lm
      
      Links file.o and passes the options -a archive, -m, and -v to the linker.

      This case is similar to the previous example, with additional options. -m indicates that a load map should be produced. -v requests verbose messages from the linker.

      argn Parameters
      Each argument, arg1, arg2, through argn to the -W option takes the form:

      -argoption[,argvalue]
      

      where:

      argoption
      is the name of an option recognized by the subprocess.
      argvalue
      is a separate argument to argoption, where necessary.

      x Parameter
      x is one or more identifiers indicating a subprocess or subprocesses. The value of x can be one or more of the following:

      a
      Assembler (standard suffix is as).
      b
      C compiler driver (cc), used to invoke the assembler.
      C (either upper or lower case)
      HP aC++ compiler (standard suffix is ctcom).
      d
      The driver program, aCC
      f
      Filter tool (c++filt).
      l
      Linker (standard suffix is ld).

      Template Options

      By using a template option on the aCC command line, you can:
      • Invoke the automatic instantiation mechanism (assigner).
      • Close a library or set of link units, to satisfy all unsatisfied instantiations without creating duplicate instantiations.
      • Specify what templates to instantiate for a given translation unit.
      • Name and use template files in the same way as for the cfront based HP C++ compiler.
      • Request verbose information about template processing.

      +inst_all
      Requests instantiation of all templates.
      +inst_auto
      Requests automatic instantiation.
      +inst_close
      Requests closure with regard to template instantiation (for libraries that contain templates).
      +inst_implicit_include
      Requests HP C++ style template files.
      +inst_include_suffixes
      Requests HP C++ template definition file name suffixes.
      +inst_none
      Requests that no templates be instantiated.
      +inst_used
      Requests instantiation of templates that are used.
      +inst_v
      Requests verbose information about template processing.

      Template Usage:

      • All template options on an aCC command line apply to every file on the command line.
      • If you specify more than one incompatible option on a command line, only the last option takes effect.
      • Only the +inst_auto option invokes the automatic instantiation mechanism and thus the assigner. All other template options (except the default, +inst_compiletime) write assigner information into .o files, allowing the files to be used with automatic instantiation if desired.

      See Also:

      +inst_all Command Line Option Syntax

      +inst_all
      

      Description:

      Causes the compiler to instantiate all template functions and all static data members and member functions of template classes defined in a translation unit, regardless of whether or not they are used, and to place these instantiations in the resulting object file.

      This option allows existing instantiations in a translation unit to be used by the assigner to satisfy instantiation requests in other translation units.

      NOTE: Because +inst_all instantiates all templates, it is essential to have a thorough understanding of your application and its template usage in order to use +inst_all effectively. Otherwise, duplicate symbols may result.

      Usage:

      This option is useful when you want to insure the file location of all templates defined in a given translation unit (for example, when preparing an object code library for distribution).

      Example:

      The following example compiles file1.C and places instantiations in file1.o.

      aCC -c +inst_all file1.C 
      

      //file1.C <p> // Define foo function template. template <class T> T foo (T i) {return i; }; <p> // Define S class template. template <class T> class S { public: int n; static int m; int f(); static int g(); }; <p> template <class T> int S<T>::m = 1; template <class T> int S<T>::f() { return 1; }; template <class T> int S<T>::g() { return 1; }; <p> // Instantiate template class S with int to define object h. <p> S<int> h; // S<int>::m, S<int>::f(), and S<int>::g() // are instantiated and placed in file1.o <p> // Instantiate template function foo with int. <p> int k=foo(1); // foo<int> is instantiated and placed in // file1.o

      Migration Note: Note that the +inst_all option differs from the HP C++ -pta option which instantiates all members of used template classes and all needed template functions.

      For More Information:

      +inst_auto Command Line Option Syntax

      +inst_auto
      

      Description:

      Requests that the automatic instantiation mechanism instantiate every template used if it is listed in the corresponding .I file. All used template functions, all static data members and member functions of template classes, and all explicit instantiations are instantiated.

      When you link or create a shared library, if there is more than one object file on the command line, the assigner determines which object file is to contain a given instantiation.

      To use +inst_auto, you must specify it at both compile-time and when creating an executable or a shared library.

      Usage:

      This option is necessary to insure that an archive library prepared for distribution is compatible with such a library prepared using the prior default (assigner) instantiation mechanism. It also facilitates use of the assigner by the library user. Refer to Deciding which Mechanism to Use.

      Example:

      The following example compiles file1.C and file2.C. Instantiations are placed in either file1.o or file2.o, as determined by the assigner during the closure operation.

      Note the use of the +inst_close option to satisfy all needed template instantiations.

      // initial compile aCC -c +inst_auto file1.C file2.C // closure operation to satisfy all unsatisfied instantiations // in file1.o and file2.o without creating duplicate instantiations aCC -c +inst_auto +inst_close file1.o file2.o

      For More Information:

      +inst_close Command Line Option Syntax

      +inst_close
      

      Description:

      Use +inst_close along with the +inst_auto option to specify that automatic instantiation be used to close a set of link units. This option prevents reinstantiation of any already instantiated templates in the .o files or libraries on the command line.

      Note that the -c option must be used with +inst_close, otherwise an executable file or (with -b) a shared library is created.

      Usage:

      +inst_close is used when closing a set of .o files to create a library.

      If you want to create a template library that uses templates, unlike a non-template library, you must instantiate the templates before linking the library.

      Archive Library Example

      To close and create an archive library containing templates, and then link the library to produce an application, use the following commands:

      aCC -c +inst_auto -Idir mylib*.C
      Compile library source files containing templates.

      aCC -c +inst_auto +inst_close mylib*.o
      Close mylib*.o files to create template instantiations in the .o files. (-c prevents linking.)

      ar cr mylib.a mylib*.o
      Create the mylib.a archive library.

      aCC -Idir myfile.C mylib.a -o application
      Link mylib.a with myfile.C to create application.

      NOTE: If a library is dependent on another template library, that template library must be on the command line when you close the dependent library. If you build an application with the dependent library, the dependee libr