cxx (1) Syntax
/usr/bin/cxx [ option ] ... file ...
An option is an optional list of compile-time options.
A file is one or more file specifications separated by white space.
You cannot group multiple options after a single hyphen; that is, `-pg ' is
different than `-p -g '.
Supply complete relative or absolute path information when the source file
is not in your current directory.
Description
The cxx command compiles C++ code into machine-readable instructions. The
desired output is specified with an option on the command line, and can be
object files or symbolic assembly language.
For additional information about this release, see the online release notes
in:
/usr/lib/cmplrs/cxx/cxxnn_release.ps/txt
HTML files are provided for the release notes and some of the product
manuals for use with a web browser. These files are installed by selecting
the following subset:
Compaq C++ HTML documentation
To view this documentation, open the following file using your web browser:
/usr/share/doclib/cplusplus/cxx.html
The compiler produces one object files for each file compiled. Additional
files can be written to the repository for template instantiations. If the
linker is called, and only one source file is specified on the command
line, the single object file is deleted after the linking operation.
The cxx command invokes the C++ compiler, and possibly other components of
the compiler system, depending on the specified command options and files.
When you start the cxx compiler, it normally performs the following tasks:
• Preprocessing
• Compiling
• Linking
Use the -c option to stop compiler operation before linking, resulting in
one or more output files with the .o suffix. Use the -E option to run only
the preprocessor.
The detection of an error in one source file does not affect compilation of
other source files specified on the same command line.
If the -x cxx option has been specified then the compiler treats all files
as C++ source files regardless of their suffixes, unless the file has an .a
or .o suffix.
If the -x cxx has not been specified, or if the -x none option has been
specified, then the compiler recognizes the following file name suffixes as
having special significance:
.cxx, .CXX, .cpp, .CPP, .cc, .CC, or .C
C++ source code.
.hxx C++ header file
.ixx C++ source code already processed by the preprocessor.
.a Linker library. -x cxx has no effect on files with this
extension.
.c C source code, to be compiled with the C compiler.
.i C source code already processed by the preprocessor.
.o Linker object module. -x cxx has no effect on files with
this extension.
.so Shared object (shared library).
Command options recognized by the cxx compiler are described in the Options
section. Some of the options affect the behavior of the preprocessor. The
preprocessor is invoked through the cxx command for C++ files, and is not
invoked with a separate command. Any options not recognized by the cxx
compiler are assumed to be linker options, and are passed through to the
linker. See the ld(1) reference page for linker options.
To facilitate setting default compiler flags, you can create an optional
configuration file named comp.config or an environment variable named
DEC_CXX.
• The comp.config file allows system administrators to establish a set
of compilation flags that are applied to compilations on a system-wide
basis. The compiler flags in comp.config must be specified on a
single line, and the comp.config file should be stored in the compiler
target directory, /usr/lib/cmplrs/cxx .
• The DEC_CXX environment variable allows users to establish a set of
compilation flags that are applied to subsequent compilation on a per
user basis.
The DEC_CXX environment variable can contain two distinct sets of
compilation flags separated by a single vertical bar (|). The flags
before the vertical bar are known as prologue flags and the flags
after the bar are know as epilogue flags.
The DEC_CXX environment variable can begin or end with a vertical bar,
or have no vertical bar at all. If no vertical bar is present, the
flags are treated as prologue flags by default. Any vertical bar
found after the first vertical bar is treated as whitespace and a
warning is issued.
Compiler flags are processed in the following order during a compilation:
1. comp.config flags
2. DEC_CXX prologue flags
3. command line flags
4. DEC_CXX epilogue flags
If -v is specified on the command line, the contents of DEC_CXX and
comp.config , if present, are displayed.
Macro Names
The following standard macro names are understood by the preprocessor.
These names cannot be redefined or undefined.
__LINE__ The current line number (a decimal integer).
__FILE__ The current file name (a character string).
__DATE__ The source file's compilation date (a character string literal
of the form "Mmm dd yyyy", where the month names are the same as
those generated by the asctime function, and the first character
of "dd" is a space character if the value is less than 10).
__TIME__ The source file's compilation time (a character string literal
of the form "hh:mm:ss"), as in the time generated by the asctime
function).
__cplusplus
Defined by the C++ compiler when compiling source code.
In addition, the following macro names are predefined for C++. These names
can be undefined or redefined. Note that some macros are defined only if
the corresponding command-line option is specified.
__alpha
__arch64__
_BOOL_EXISTS
__BOOL_IS_A_RESERVED_KEYWORD
__CFRONT
__DECCXX
__DECCXX_VER
__digital__
__EXCEPTIONS
__FLT_ROUNDS
__GLOBAL_ARRAY_NEW
__IEEE_FLOAT
_IEEE_FP
__IMPLICIT_INCLUDE_ENABLED
__IMPLICIT_USING_STD
__INITIAL_POINTER_SIZE
__MS
__osf__
__PCH_ENABLED
__PRAGMA_ENVIRONMENT
_PTHREAD_USED_D4
_REENTRANT
__RTTI
__STDNEW
__STD_ANSI
__STD_ARM
__STD_CFRONT
__STD_MS
__STD_STRICT_ANSI
__STD_STRICT_ANSI_ERRORS
__unix
__unix__
_WCHAR_T
__X_FLOAT
These names are useful in preprocessor #ifdef and #if defined directives to
isolate code intended for one of the particular cases. The names can be
used anywhere you use other defined names, including within macros.
Options
The following sections describe the cxx command options, which are grouped
as follows:
• General options
• Preprocessor options
• Language Mode options
• Message Information and Control options
• Standard Library options
• Precompiled Header options
• Template options
The notation "cxx -newcxx only" indicates that an option works only with
the default compiler and is ignored by the old compiler. The notation
"cxx -oldcxx only" indicates that an option works only with the old
compiler and is ignored by the default compiler. Otherwise, the option
works with both compilers.
General Options
The cxx command supports the following general options:
-alternative_tokens (cxx -newcxx only)
-noalternative_tokens (cxx -newcxx only)
Enables use of the following operator keywords and digraphs
to generate tokens:
________________________
Operator Keyword Token
________________________
and &&
and_eq &=
bitand &
bitor |
compl ~
not !
not_eq !=
or ||
or_eq |=
xor ^
xor_eq ^=
_______________
Digraph Token
_______________
:> ]
%: #
%> }
<% {
<: [
The default is -noalternative_tokens when compiling -std
arm, -std cfront, -std ms, and -std ansi. The default is
-alternative_tokens when compiling -std strict_ansi and -std
strict_ansi_errors.
-[no]ansi_alias (cxx -newcxx only)
Directs the compiler to assume the ANSI C aliasing rules. By
so doing, the compiler has the freedom to generate better
optimized code.
If a program does not access the same data through pointers
of a different type (and for this purpose, signed and
qualified versions of an otherwise same type are considered
to be the same type), then assuming ANSI C aliasing rules
allows the compiler to generate better optimized code.
If a program does access the same data through pointers of a
different type (for example, by a "pointer to int" and a
"pointer to float", you must not allow the compiler to
assume ANSI C aliasing rules, because these rules can result
in the generation of incorrect code.
The default is ansi_alias .
-arch option Specifies the version of the Alpha architecture for which to
generate instructions. All Alpha processors implement a
core set of instructions and, in some cases, the following
extensions: BWX (byte- and word-manipulation instructions)
and MAX (multimedia instructions). (The Alpha Architecture
Reference Manual describes the extensions in detail.)
The option specified by the -arch flag determines which
instructions the compiler can generate:
generic Generate instructions that are appropriate for all
Alpha processors. This option is the default.
host Generate instructions for the processor on which
the compiler is running (for example, EV56
instructions on an EV56 processor, and EV4
instructions on an EV4 processor).
ev4,ev5 Generate instructions for the EV4 processor
(21064, 20164A, 21066, and 21068 chips) and EV5
processor (some 21164 chips). (Note that the EV5
and EV56 processors both have the same chip number
- 21164.)
Applications compiled with this option do not
incur any emulation overhead on any Alpha
processor.
ev56 Generate instructions for EV56 processors (some
21164 chips).
This option permits the compiler to generate any
EV4 instruction, plus any instructions contained
in the BWX extension.
Applications compiled with this option can incur
emulation overhead on EV4 and EV5 processors.
ev6 Generate instructions for EV6 processors (some
21264 chips).
This option permits the compiler to generate any
EV6 instruction, plus any instructions contained
in the following extensions: BWX, MVI, FIX, and
SIX.
pca56 Generate instructions for PCA56 processors
(21164PC chips).
This option permits the compiler to generate any
EV4 instruction, plus any instructions contained
in the BWX or MAX extensions.
Applications compiled with this option can incur
emulation overhead on EV4, EV5, and EV56
processors.
A program compiled with any of the options runs on any Alpha
processor. Beginning with Version 4.0 of the operating
system and continuing with subsequent versions, the
operating system kernel includes an instruction emulator.
This capability allows any Alpha chip to execute and produce
correct results from Alpha instructions - even if some of
the instructions are not implemented on the chip.
Applications using emulated instructions run correctly, but
can incur significant emulation overhead at run time.
The psrinfo -v command can be used to determine which type
of processor is installed on any given Alpha system.
-assume option Allow the compiler to make assumptions regarding certain
alignments or code transformations. The following options
are supported:
[no]accuracy_sensitive
Specify whether certain code transformations that
affect floating-point operations are allowed. These
changes may affect the accuracy of the program's
results.
The accuracy_sensitive option directs the compiler to
use only certain scalar rules for calculations. This
setting can prevent some optimizations. This is the
default.
The noaccuracy_sensitive option frees the compiler to
reorder floating-point operations based on algebraic
identities (inverses, associativity, and distribution).
This allows the compiler to move divide operations
outside of loops, which may improve performance.
[no]aligned_objects
The aligned_objects option causes the compiler to
assume that a dereferenced object's alignment matches
or exceeds the alignment indicated by the pointer to
the object. This is the default. On Compaq Tru64 UNIX
systems, dereferencing a pointer to a longword- or
quadword-aligned object is more efficient than
dereferencing a pointer to a byte- or word-aligned
object. Therefore, when the compiler assumes that a
pointer object of an aligned pointer type does point to
an aligned object, it can generate better code for
pointer dereferences of aligned pointer types.
The noaligned_objects option flag causes the compiler
to generate longer code sequences to perform indirect
load and store operations in order to avoid hardware
alignment faults for arbitrarily aligned addresses.
Although this flag may generate less efficient code
than the aligned_objects option, by avoiding hardware
alignment faults, it speeds the execution of programs
that reference unaligned data.
[no]trusted_short_alignment
Control the alignment assumptions for code generated
for indirect load and store instructions.
The trusted_short_alignment option indicates that the
compiler should assume any short accessed through a
pointer is naturally aligned. This generates the
fastest code, but can silently generate the wrong
results when an unaligned short object crosses a
quadword boundary.
The notrusted_short_alignment option tells the compiler
that short objects might not be naturally aligned. The
compiler generates slightly larger (and slower) code
that will give the correct result, regardless of the
actual alignment of the data. This is the default.
The notrusted_short_alignment option does not override
the __unaligned type qualifier, the -misalign flag, or
the -assume noaligned_objects flag.
[no]ptrs_to_globals (cxx -newcxx only)
Control whether the compiler can safely assume that
global variables have not had their addresses taken in
code that is not visible to the current compilation.
The default is ptrs_to_globals , which directs the
compiler to assume that global variables have had their
addresses taken in separately compiled modules and that
a pointer dereference in the module could be accessing
the same memory as a global variable. This is often a
significant barrier to optimization.
While the ansi_alias option allows some resolution
based on data type, ptrs_to_globals provides
significant additional resolution and improved
optimization in many cases.
noptrs_to_globals tells the compiler that any global
variable accessed through a pointer in the compilation
unit must have had its address taken within that
compilation unit. The compiler can see any code that
takes the address of an extern variable. If it does not
see the address of the variable being taken, the
compiler can assume that no pointer within this
compilation unit points to the variable.
[no]whole_program (cxx -newcxx only)
Assert to the compiler that except for "well-behaved
library routines", the whole program consists only of
the single object module being produced by this
compilation. The optimizations enabled by whole_program
include all those enabled by nopointer_to_globals , and
possibly other optimizations.
The default is nowhole_program .
-B string Append string to all names specified by the -t flag. If no
-t flag has been processed before the -B option, then a
-B string flag is passed to the loader to use with its -lx
arguments and the -t flag is assumed to be
hpfjusmocablyzrntL . This list designates all names.
Invoking the compiler with a name of the form cxx string has
the same effect as using -B string flag on the command line.
-c Suppress the linking phase of the compilation and force
production of one or more object file(s) with the .o suffix.
If the file name argument already has the .o suffix, do
nothing at all.
-call_shared Produce a dynamic executable file that uses shareable
objects during run-time. This is the default. The loader
uses shareable objects to resolve undefined symbols. The
run-time loader (/sbin/loader) is invoked to bring in all
required shareable objects and to resolve any symbols that
remained undefined during static link time.
-cfront Interpret source programs according to some language
conventions followed by AT&T's "cfront" implementation. This
option also defines the macro __CFRONT .
-check (cxx -oldcxx only)
This option has no effect when -newcxx is specified.
Perform compile-time code checking. With this option, the
compiler checks for code that exhibits nonportable behavior,
represents a possible unintended code sequence, or possibly
affects program operation because of a quiet change in the
language standard. Some of these checks traditionally have
been associated with the lint utility.
-[no]compress Cause the output object file or instantiated object file to
be produced in compressed object file format, resulting in a
substantially smaller object file. To produce uncompressed
files, specify -nocompress . The default is -compress .
-cord Run the procedure rearranger on the resulting file after
linking. Rearrangement is performed to reduce the cache
conflicts of the program's text. At least one -feedback file
must be specified.
-denorm Force denormalized constant numbers to zero when IEEE
support is enabled.
-distinguish_nested_enums
Change the compiler's name mangling scheme to include the
name of any class, if any, that an enum type is nested
within. This allows functions to be overloaded when the
only difference in the parameter types is one parameter is
an enum with a particular name and the other parameter is an
enum with the same name nested within a class (or nested
within a different class). In general, if you compile one
module of your program with this switch, you should compile
all modules with this switch. Using this switch may make it
difficult to link with libraries or old object files due to
differences in mangled names. See the
release notes for
more information.
-error_limit n Specify the number of errors allowed before compilation
stops.
-feedback file This option is used with the -cord option to specify a
feedback file. The feedback file is produced by the prof
command with its -feedback option from an execution of the
program produced by the pixie command.
-fprm option Specify rounding mode. The following options are supported:
c Round toward 0 (chop).
d Set rounding mode for IEEE floating-point instructions
dynamically, as determined from the contents of the
floating-point control register. The dynamic rounding
mode can be changed or read at execution time by a call
to write_rnd(3) or read_rnd(3). If you specify this
option, the IEEE floating-point rounding mode defaults
to round to nearest.
m Round toward minus infinity.
n Set normal rounding mode (unbiased round to nearest).
This is the default.
-fptm option Specify trapping mode. Only one option can be used on a
command line. The following options are supported:
n Generate instructions that do not trigger floating-
point underflow or inexact trapping modes. Any
floating point overflow, divide-by-zero, or invalid
operation will unconditionally generate a trap. This is
the default.
u Generate intstructions that trap floating-point
underflow, overflow, divide-by-zero, and invalid
operations.
-fp_reorder Same as -assume noaccuracy_sensitive .
-g Produce symbol table information for full symbolic
debugging, but do not perform optimizations that limit full
symbolic debugging. Same as -g2 .
If the debugger describes a class as <opaque> or lacks
debugging information, you may need to compile particular
files using the -gall option.
-g0 Do not produce symbol table information for symbolic
debugging. This is the default.
-g1 Produce symbol table information for accurate, but limited,
symbolic debugging of partially optimized code.
-g2 Produce symbol table information for full symbolic
debugging, but do not perform optimizations that limit full
symbolic debugging. Same as -g .
-g3 Produce symbol table information for full symbolic debugging
of fully optimized code. This option can affect debugger
accuracy.
-gall Generate full symbol table information for all classes,
structs, and unions. If you specify -gall , -g is assumed.
See the release notes
(/usr/lib/cmplrs/cxx/cxxnn_release.ps/txt) for more
information on this option.
-gall_pattern Generate full symbol table information for all classes,
structs, and unions if the name of the file being compiled
matches the pattern. The pattern can be a list of file
names (with each file name separated by a comma or colon),
filename patterns, or a combination of a file name list and
filename patterns. The -gall_pattern option is ignored
unless -g , -g2 , or -g3 is also specified. See fnmatch(3) for
valid filename patterns.
-G num Specify the maximum size, in bytes, of a data item that is
to be accessed from the global pointer. The num argument is
interpreted as a decimal number. If num is zero, data is
not accessed from the global pointer. The default value for
num is 8 bytes.
-gen_feedback Generate accurate profile information to be used with
-feedback optimizations. Such optimizations should be used
in the compiling and linking phases. When compiling a
program for profiling, add -gen_feedback to your existing
set of command line flags. The -gen_feedback flag should
not be used when generating profile information.
-[no]global_array_new (cxx -newcxx only)
Controls whether calls to global array new and delete are
generated as specified by ANSI. Pre-ANSI global array new
generated calls to operator new(). According to ANSI, use of
global array new generate calls to operator new()[]. This
option also defines the macro __GLOBAL_ARRAY_NEW .
-global_array_new generates calls to operator new()[] for
global array new expressions such as new int[4]; this is the
default when compiling -std ansi, -std strict_ansi, -std
strict_ansi_errors, and -std ms.
-noglobal_array_new generates calls to operator new() for
global array new expressions such as new int[4] and
preserves compatibility with V5.n; this is the default when
compiling -std arm and -std cfront. Note that 'arm' refers
to The Annotated C ++ Reference Manual by Ellis and
Stroustrup, 1990 edition.
-h dir Use the specified directory instead of the directory where
the name specified by the -t flag is normally found.
-H c Halt compiling after the stage specified by the character c ,
producing an intermediate file for the next stage. The c
argument can be any one of the following:
f C++ compiling and template instantiating
a as0
b as1
l ld
y ftoc
z cord
-ieee Support all portable features of the IEEE Standard for
Binary Floating-Point Arithmetic (ANSI/IEEE Standard 754-
1985), including the treatment of denormalized numbers,
NaNs, infinities, and the handling of error cases. This flag
also sets the _IEEE_FP macro.
-inline keyword
Specifies whether to provide inline expansion of functions.
The -no_inline flag disables the inlining optimization that
would otherwise be performed by default under the following
compiler optimization -O[n] flags:
- When -O2 , -O3 , or -O4 is specified.
You can specify one of the following as the keyword to
control inlining:
all Inline every call that can be inlined while still
generating correct code. Recursive routines, however,
will not cause an infinite loop at compile time.
manual
Inline only those function calls explicitly requested
for inlining by an inline keyword. This is the default
when compiling with the -O1 flag.
none Do not do any inlining. This is the default when
compiling with the -O0 optimization level.
size Inline all of the function calls in the manual
category, plus any additional calls that the compiler
determines would improve run-time performance without
significantly increasing the size of the program. This
the default when compiling with either the -O2 or the
-O3 flag.
speed
Inline all of the function calls in the manual
category, plus any additional calls that the compiler
determines would improve run-time performance, even
where it may significantly increase the size of the
program.
For optimization level 0 (-O0 ), the -inline flag is ignored
and no inlining is done.
-K Build and use intermediate files, producing a file with the
conventional extension for the type of file. These
intermediate files are not removed, even when a stage
encounters a fatal error. Extensions are appended to the
output if the output file does not already have an
extension.
-machine_code List the generated machine code in the listing file. To
produce the listing file, you must also specify the
-source_listing option. The default is to not list the
generated machine code.
-misalign Specify that code generated for indirect load instructions
and store instructions not generate alignment faults for
arbitrarily aligned addresses. Using this flag increases
the size of generated code and might have a negative impact
on performance. The default condition is for code generated
for indirect load instructions and store instructions to
generate alignment faults for arbitrarily aligned addresses.
-ms Interpret source programs according to some language
conventions followed by Microsoft's Visual C++
implementation. This option also defines the macro __MS .
-newcxx Invoke the version 6.0 compiler. This is the default.
-no_misalign Negate the -misalign flag.
-no_pg Selectively disable profiling for individual modules when
using the -pg graph profiling option.
-nocleanup Disable generation of implicit exception handlers.
Procedures without explicit handlers may have implicit
handlers. For example, the compiler creates a handler for
each automatic object that has a destructor. The compiler
also creates handlers for constructors that initialize
subobjects that have destructors. In such a constructor, the
compiler creates a handler for each member with a
destructor, and a handler for each base class with a
destructor. The -nocleanup option suppresses generation of
such implicit handlers, which results in a slightly smaller
executable.
The -nocleanup option results in smaller and faster programs
by suppressing all runtime invocation of destructors during
transfer of control out of a scope by way of throw or
longjmp . You should not use the -nocleanup option to build
programs that expect destructors to be invoked for local
variables when the stack is unwound by a thrown exception,
or a call to exc_longjmp .
-nodemangle Do not pipe linker messages through the demangler. This
causes linker messages to contain mangled names. By
default, cxx pipes linker messages through the demangler so
that demangled names are displayed.
-[no]exceptions
Specify -noexceptions to disable C++ exceptions as follows:
•
The compiler diagnoses warnings for throw expressions, try
blocks, and catch statements, but might generate code for
these constructs.
•
The compiler does not generate cleanup code for automatic
objects.
•
The compiler does not generate special code for main
programs so that the terminate() function is called for
unhandled exceptions.
Specify -exceptions to reenable normal exception handling.
-noinline Do not compile any function calls as inline code.
-noinline_auto Compile only inline functions that are explicitly declared
to be inline.
-nomember_alignment
Direct the compiler to byte-align data structure members,
except for bit-field members. By default, data structure
members are aligned on natural boundaries (that is, the next
boundary appropriate to the member type) rather than the
next byte. Using any of the #pragma [no]member_alignment or
#pragma pack directives in the source code overrides the
setting established by this flag.
-non_shared Do not produce a dynamic executable file. The loader uses
regular archives to resolve undefined symbols and object
files (.o suffix) from archives that are included in the
executable produced.
-noobject Do not produce an object file.
-oldcxx Invoke a bug fix update to the Version 5.7 compiler. This
option is provided for cases where the Version 6.0 compiler
requires excessive source changes or for problems in using
the Version 6.0 compiler. If extensive source changes are
required to correct errors, try using the -std arm option.
For excessive warnings, try the -msg_quiet option. If you
want -oldcxx to be the default, define the DEC_CXX
environment variable as follows:
setenv DEC_CXX "-oldcxx"
-no_vtable_info
Tells the demangler to suppress the display of information
concerning internal symbols (specifically __vtbl and __btbl )
-o file Name the final output file , rather than use the default
a.out. The given name is used regardless of the type of file
(executable, object, or other type).
-O[ n ] Determine the level of optimization.
_____________________________________
Option Optimization
_____________________________________
-O0
No optimization.
-O1
Optimization with space as
the primary criterion.
This is the default if no
optimization option is
specified.
-O2
Optimization with time as
the primary criterion.
This is the default if you
specify -O without a level
number.
-O3
Same as -O2 for C++. If
you use the cxx command to
compile C source files, -
O3 enables inline
expansion of C global
functions.
-O4 , -O5
Additional global
optimizations that improve
speed at the cost of extra
code size. -O4 and -O5
have the same effect.
_____________________________________
In addition to affecting the generated code, the -O level is
passed on to ld and is used by both ld and -om (if -om is
specified).
The general guidelines for optimization are as follows:
•
If the speed of the generated code is more important than
code size, specify -O (same as -O2 ). In some cases, -O4
may produce faster code. Using inline all at -O or -O4 may
inline more calls (particularly calls to constructors) and
improve speed, but this option may increase the code size
for some programs beyond an acceptable limit. If you are
potentially interested in this option, you should build
your program both with and without the option and compare
the code size.
•
If the size of the generated code is more important than
speed, some experimentation may be necessary to determine
the best optimization option. Whereas -O1 (default if an
optimization level is not specified) is intended to
optimize for code size, in some cases code that is
compiled with -O (or -O2 ) to optimize for speed may
actually be smaller. Also try -O -unroll 1 to see if a
smaller size is generated. Using -unroll 1 disables a
loop unrolling optimization and generally reduces the code
size when -O is used. You might also try compiling with
the -noinline option both with and without -O to see if a
reduction in code size occurs.
Other switches that can possibly affect run-time size and
speed are as follows:
compiler
-fp_reorder , -misalign , -nocleanup , -noinline , -tune ,
-assume trusted_short_alignment , -unroll
linker
-non_shared , -om
When you use -g for best debugging, optimizations are
suppressed. Thus, when comparing the effects of different
optimization levels, you should not specify -g or -g2 . For
such comparisons, you specify -g0 , which suppresses
debugging information.
-om Perform code optimization after linking, including nop (No
Operation) removal, .lita removal, and reallocation of
common symbols. This flag also positions the global pointer
register so the maximum addresses fall in the global
pointer-accessible window. The -om flag is supported only
for programs compiled with the -non_shared flag. The
following options can be passed directly to -om by using the
-WL compiler flag:
-WL,-om_compress_lita
Remove unused .lita entries after optimization, and
then compress the .lita section.
-WL,-om_dead_code
Remove dead code (unreachable instructions) generated
after applying optimizations. The .lita section is not
compressed by this flag.
-WL,-om_ireorg_feedback, file
Use the pixie-produced information in file.Counts and
file.Addrs to reorganize the instructions to reduce
cache thrashing.
-WL,-om_no_inst_sched
Disable instruction scheduling.
-WL,-om_no_align_labels
Disable alignment of labels. Normally, the -om flag
quadword-aligns the targets of all branches to improve
loop performance.
-WL,-om_Gcommon, num
Set size threshold of "common" symbols. Every "common"
symbol whose size is less than or equal to num will be
allocated close to each other. This flag can be used to
improve the probability that the symbol can be accessed
directly from the global pointer register. Normally,
the -om flag causes the compiler to try to collect all
"common" symbols together.
-p Perform profiling by periodically sampling the value of the
program counter. This option affects only linking. When
linking is done, this option replaces the standard run-time
startup routine with the profiling run-time startup routine
(mcrt0.o) and searches the level 1 profiling library
(libprof1.a). When profiling is completed, the startup
routine calls the monstartup routine and produces a mon.out
file that contains execution-profiling data for use with the
postprocessor prof. Same as -p1 .
-p0 Do not perform profiling. This is the default.
-p1 Perform profiling by periodically sampling the value of the
program counter. This option affects only linking. When
linking is done, this option replaces the standard run-time
startup routine with the profiling run-time startup routine
(mcrt0.o) and searches the level 1 profiling library
(libprof1.a). When profiling is completed, the startup
routine calls the monstartup routine and produces a mon.out
file that contains execution-profiling data for use with the
postprocessor prof. Same as -p .
-pg Perform call graph profiling using the gprof tool.
For more information on profiling C++ code, see the DIGITAL
UNIX Programmer's Guide and the gprof(1) reference page.
-preempt_module
Provide module preemption, but not full symbol preemption.
Module preemption allows the replacement of the definitions
of all of the symbols corresponding to a compilation unit
(that is, a single object file generated from a .cxx file).
Module preemption would take effect if you modified and
recompiled a .cxx file, and linked the new .o file into the
main object, thus "replacing" all of the .cxx file's
external symbols from the shared library. Unlike full
symbol preemption, module preemption does not support
replacing individual symbols because the compiler may
perform optimizations that take advantage of information
about symbols defined within a module.
This is the default behavior at all optimization levels.
You can use -preempt_symbol to provide full symbol
preemption.
-preempt_symbol
Provide full symbol preemption. Full symbol preemption
allows the replacement of the definition of an individual
external symbol (function or data) in a shared library.
This "replacement" occurs at runtime when the dynamic loader
uses a definition of the symbol from the main object or some
other shared library in preference to the definition in the
original shared library. This behavior may be important
when a particular symbol is defined in both the main object
and in a shared library (or in multiple shared libraries).
-protect_headers [all | none ]
Enables the protection of system header files as described
in Using Compaq C ++ for Compaq Tru64 UNIX . The default is
all . Specifying none disables protection.
-pthread Direct the linker to use the threadsafe version of any
library specified with the -l flag when linking programs.
This flag also tells the linker to include the POSIX
1003.1c-conformant DECthreads interfaces in libpthread when
linking the program.
-r Retain relocation entries in the output file. Relocation
entries must be saved if the output file is to become an
input file in a subsequent linker run. This option prevents
final definitions from being given to common symbols; it
also suppresses the diagnosis of undefined symbols.
-readonly_strings
Make all string literals readable only. This is the
default.
-[no]rtti (cxx -newcxx only)
Enable or disable support for RTTI (runtime type
identification) features: dynamic_cast and typeid.
Disabling runtime type identification may also save space in
your object file because static information to describe
polymorphic C++ types is not generated. The default is to
enable runtime type information features and generate static
information in the object file.
Specifying -nortti does not disable exception handling.
-rpath string Set the rpath to the specified string. This option is
meaningful for shared linkage only.
-S Compile the specified source programs and produce symbolic
assembly language in corresponding files with a .s suffix.
Do not assemble these files. If the file name argument
already has a .s suffix, do nothing at all.
-SD [directory ] Suppress certain warning- and informational-level diagnostic
messages that are inappropriate for system header files. The
suppressed messages relate to non-portable constructs in
header files whose pathnames are prefixed by string
directory.
The default is -SD/usr/include.
Specifying -SD without a directory string cancels the effect
of any previous -SD flags on the command line (including the
default, -SD/usr/include). It also disables the
-protect_headers feature's suppression of diagnostic
messages by defining the macro __DECC_EMPTY_SD_OPTIONS .
(The -protect-headers feature provides message suppression
in the file __DECC_include_prologue.h .)
-shared Produce a shared object. This includes creating all of the
tables for run-time linking, and resolving references to
other specified shared objects. The object created can be
used by the linker to make dynamic executables. Using
dlopen() /dlclose() guarantees that the appropriate
constructors/destructors are called.
-show keyword [,keyword ,...]
Specify one or more items to be included in the listing
file. When specifying multiple keywords, separate them by
commas (with no intervening blanks). To use any of the -show
keywords, you must also specify the -source_listing option.
The -show keywords are as follows:
all Enable all options.
[no]header Specify whether to produce header lines at
top of each page of listing.
[no]include Specify whether to place contents of #include
files in the program listing.
none Negate all options.
[no]source Specify whether to place source program
statements in the program listing.
The default is -show header,source .
-show_mangled_name
Tell demangler to display encoded name in parentheses after
demangled name.
-signed Cause all char declarations to have the same machine
representation and value set as signed char declarations.
This is the default.
-source_listing
Produce a source code listing file of the same name as the
source file, but with the suffix .lis.
-[no]stdnew Controls whether calls are generated to the ANSI or pre-ANSI
implementation of the operator new(). On memory allocation
failure, the ANSI implementation throws std::bad_alloc while
the pre-ANSI implementation returns 0. This option also
defines the macro __STDNEW .
-stdnew generates calls to the ANSI new() implementation;
this is the default when compiling -std ansi, -std
strict_ansi and -std strict_ansi_errors.
-nostdnew generates calls to the pre-ANSI new()
implementation; this is the default when compiling -std arm,
-std cfront and -std ms.
For information about overriding ANSI new(),pre-ANSI new(),
or both, see the discussion in the C++ Standard Library
chapter of Using Compaq C ++ for Tru64 UNIX .
-strong_volatile
Allow byte and word access of data at byte granularity by
using a load-locked instruction sequence for byte and word
stores. This means that, for assignments to objects that are
less than or equal to 16 bits in size and have been declared
as volatile, assignments to adjacent volatile small objects
by different threads in a multithreaded program will not
cause one of the objects to receive an incorrect value.
The generated code includes a load-locked instruction for
the enclosing longword or quadword, an insertion of the new
value of the object, and a store-conditional instruction for
the enclosing longword or quadword.
-t Select a name to use for a particular pass, startup routine,
or standard library from the set of -t [fablyzrnLM] , -h
path , and -B string flags. These arguments are processed from
left to right so their order is significant. When the -B
flag is encountered, the selection of names takes place
using the last -h and -t flags. Therefore, the -B flag is
always required when using -h or -t . Sets of these flags
can be used to select any combination of names.
The -p[01] flags must precede all -B flags because they can
affect the location of run times and what run times are
used.
Use the -t [fablyzrnLM] suboptions to select the names. The
names selected are those designated by the characters
following the -t flag according to the following table:
f C++ compiling and template instantiating
a as0
b as1
l ld
y ftoc
z cord
r [m]crt0.o
n libprof1.a
L om
M _main.o
-taso Tell the linker that the executable file should be loaded in
the lower 31-bit addressable virtual address range. You can
also use the -T and -D options to the ld command to ensure
that the addresses of text and data segments are loaded into
low memory.
Besides setting default addresses for text and data
segments, the -taso option also causes shared libraries
linked outside the 31-bit address space to be appropriately
relocated by the loader. If you specify -taso and also
specify text and data segment addresses with -T and -D ,
those addresses override the -taso default addresses. The -
taso option is useful for porting 32-bit programs to Compaq
Tru64 UNIX.
-threads Direct the linker to use the thread-safe version of any
library specified with the -l flag when linking programs.
This flag also tells the linker to include both the
DECthread interfaces that are conformant with POSIX 1003.4a
Draft 4. The flag is supported only for compatability with
earlier releases of the operating system. New designs should
use the -pthread flag.
-trapuv Forces all uninitialized stack variables to be initialized
with 0xfff58005fff58005. When this value is used as a
floating-point variable, it is treated as a floating-point
NaN and causes a floating-point trap. When it is used as a
pointer, an address or segmentation violation usually
occurs.
For programs compiled without the -trapuv switch, the
debugger stops only on executable statements in which the
value of a specified variable changes. With the -trapuv
switch, the debugger stops on these statements and also
stops on all local variable declarations. (The debugger
treats the local variable declarations as assignment
statements because the variables are initialized by the
compiler.)
-tune option Select processor-specific instruction tuning for
implementations of the operating system architecture. Using
the -tune option causes the generated code to run correctly
on all implementations of the architecture. Tuning for a
specific implementation may improve run-time performance;
however, code tuned for a specific target may run slower on
another target.
The options are: generic (tune appropriate to all
architectures), host (tune appropriate to the machine
compiling the code), ev4 (tune for the 21064, 21064A, 21066,
and 21068), and ev5 (tune for the 21164). The default is -
tune generic .
In addition to affecting the generated code, -tune is passed
on to ld and is used by both ld and -om (if -om is
specified).
-unroll n Control loop unrolling done by the optimizer. n signifies
the number of times to unroll loop bodies. Specifying zero
for n tells the optimizer to use its own default unroll
amount. This is the default.
-unsigned Cause all char declarations to have the same machine
representation and value set as unsigned char declarations.
The -unsigned option overrides -signed if both are specified
on the command line.
-[no]use_ld_input=filespec
use_ld_input directs the compiler to record the names of
requested automatic template instantiation object files in a
linker options file. By default, the compiler creates the
linker options file with an appropriate name in the
repository. If you specify the filespec parameter, the
compiler uses that file specification and does not delete
the file after compilation. On subsequent calls, the
compiler begins linking with all all objects listed in the
options file. To prevent inclusion of these objects, you can
delete the options file.
The compiler then adds the linker options file to the ld
command line using the ld -input <file> option.
The default behavior is use_ld_input .
nouse_ld_input directs the compiler to record the names of
requested automatic template instantiation object files on
the command line so that you can determine the objects with
which you are linking. However, if there are many object
files, you might receive Arg list too long messages.
-v Print the names of compiler phases as they execute, along
with their arguments and input and output files. This
option also prints resource usage in the following format:
user time, system time, total elapsed time, percentage use
of CPU cycles.
-V Enable printing of the version of the compiler and its
phases.
-verbose Include identifiers with diagnostic messages. These
identifiers can be used with #pragma message directives.
-volatile Compile all variables as volatile.
-vptr_size Make 64-bits the default size of virtual function and
virtual base pointers in a C++ class object (64-bits is the
normal default). This option also enables #pragma
pointer_size and passes -taso to the linker.
-vptr_size_short
Make 32-bits the default size of virtual function and
virtual base pointers in a C++ class object. This option
also enables #pragma pointer_size and passes -taso to the
linker.
-w Suppress warning and informational level compiler messages,
but not back-end messages. Same as -w2 .
-w0 Display all levels of compiler messages.
-w1 Suppress information-level compiler messages. This is the
default.
-w2 Suppress warning- and informational-level compiler messages,
but not back-end messages. Same as -w .
-W c [c ...],arg1 [,arg2 ...]
Pass the arguments arg1 to the compiler stages c [c ..]. Use
this option to pass arguments through to a particular stage,
which otherwise would be consumed by an earlier stage. The
c argument selects the compiler stage in the same way as it
does in the -H option. Valid characters for c are: a, b, f,
l, L, n, r, t, y, z.
-weak_volatile Do not generate load-locked instructions for a sequence of
byte or word stores for assignments to objects that are less
than or equal to 16 bits in size and have been declared as
volatile. This allows byte or word access to memory-like I/O
devices for which larger access will not cause read or write
side effects. Because the sequence does not access byte or
word data independently directly in memory (that is, ensure
byte granularity), adjacent volatile data can be corrupted
when such byte or word accesses are performed in a
multithreaded environment (for example, two volatile shorts
stored in a longword and accessed asynchronously).
-writable_strings
Make string literals writable.
-x cxx Cause all subsequent file names to be compiled as C++ source
files, regardless of their suffixes. This option applies to
all following file names up to the next -x option, except
for files with the .a or .o suffix.
-x none Cause all subsequent file names to be treated according to
their file name suffixes. This option is the reverse of the
-x cxx option. It applies to all following file names until
the next -x option.
In the following example, files one.cxx and two.c will be
compiled as C++ source files, and file three.c will compiled
as a C source file:
cxx one.cxx -x cxx two.c -x none three.c
The -x none option is the default.
-xref
-xref_stdout Direct the compiler to generate a data file that the DEC
FUSE Database Manager uses to create a cross-reference
database file. This database file is used by the DEC FUSE
C++ Class Browser, Call Graph Browser, and Cross-Referencer.
Specifying the -xref_stdout option directs the compiler to
output the data file to standard output.
-xtaso Enable #pragma pointer_size and pass -taso to the linker.
Note that if -xtaso_short has set the default pointer size
of the compilation unit to 32-bits (64-bits is the normal
default), subsequently specifying -xtaso on the command line
will not reset the pointer size.
-xtaso_short Set the default pointer size of the compilation unit to 32-
bits (for all pointers except virtual function and virtual
base pointers). This option also enables #pragma
pointer_size and passes -taso to the linker. The this
pointer is unaffected by this option, it remains the system
default pointer size, which is 64 bits.
-Zp n Align structure members as specified by the value of n ,
which can be 1, 2 or 4. This flag specifies packing so that
each structure member after the first is stored on the n
byte boundaries specified. Specifying Zp without any
integer value causes structure members to be packed on 1-
byte boundaries.
Preprocessor Options
The following cxx command options control the action of the preprocessing
phase:
-cpp Run the preprocessor on the source files before compiling.
This is the default. If both -cpp and -nocpp are included
on the command line, the option specified last is in effect.
-nocpp (cxx -oldcxx only)
Do not run the preprocessor on the source files before
compiling. If both -nocpp and -cpp are included on the
command line, the option specified last is in effect. If -P
or -E is specified, -nocpp has no effect.
-C Prohibit the preprocessor from removing comments in the
source file. (Use with the -E or -Em option.)
-D name =def
-D name Define name to the preprocessor, as if the line #define name
def were prepended to the C++ source file. There can be a
space between the option and name . If name or def contains
a dollar sign ($), they must be surrounded by apostrophes
('). If no =def is given, the name is defined as 1.
-E Run only the preprocessor on the source files (regardless of
whether a suffix exists), and send the result to the
standard output. This sets the -cpp option.
-Em Run only the preprocessor on the source files (regardless of
whether a suffix exists), and produce makefile dependencies
instead of the usual output. For each source file, the
preprocessor creates one makefile entry naming the object
file and listing all included files as dependencies. Same
as -M .
-I Do not search for #include files in the standard
directories, /usr/include/cxx and /usr/include. Because -I
can be followed by a directory, do not place a nondirectory
file name on the command line immediately following -I . If
-I is being used without a directory, follow it with another
option or place it at the end of the command line to avoid
misinterpretation.
-I dir Define the directory name dir to the preprocessor for use in
searching for quoted and angle-bracketed include files.
There can be a space between the option and dir . The
preprocessor searches for include file names that do not
begin with a slash (/) in the following order:
•
Quoted file names:
1.
In the directory containing the source file with the
#include directive.
2.
In the directories specified by the -I option.
3.
In the /usr/include/cxx and /usr/include directories.
•
Angle-bracketed files are searched for in the list of
directories specified on the command line, then in the
/usr/include/cxx directory, and finally, in the
/usr/include directory.
If -nocurrent_include is specified, the preprocessor does
not search in the directory containing the source file (#1
above).
-M Run only the compiler on the source files (regardless of
whether a suffix exists), and produce makefile dependencies
instead of the usual output. For each source file, the
preprocessor creates one makefile entry naming the object
file and listing all included files as dependencies. To
identify correctly the template implementations on which
source depends, the compiler parses and analyzes the source;
the source must be a valid C++ program. To disable this
analysis, specify the -noimplicit_include switch. Same as -
Em .
-MD Produce a dependency file, which has the suffix .d appended
to the object file name. This dependency file is created
even if the object file is not. The information and the
format in the dependency file is identical to that produced
by the -M flag. The -MD flag allows dependency information
to be generated at the same time that a compilation is
occurring.
-nocurrent_include
Do not search for quoted include files in the directory
containing the source file with the #include line. The
preprocessor will still search the directories specified by
the -I option and in the standard directory (/usr/include).
See also the -I dir option.
-oldcomment Remove comments from preprocessor output files and replace
the comments with nothing.
-P Run only the preprocessor and put the result for each source
file in a corresponding .ixx file, without including line
numbers. The -P option has no effect if specified after -E
or -Em . If specified before -E , it overrides -E . If
specified before -Em , it writes the makefile dependencies to
.ixx files.
-U name Cancel any command-line definition of name to the
preprocessor, as if the line #undef name were prepended to
the C++ source file. There can be a space between the
option and name . If name contains a dollar sign ($), name
must be surrounded by apostrophes ('). The undefine
operation occurs after any definitions produced by the -D
options. Symbols defined by default are listed in the
Description section.
If the environment variable COMP_HOST_ROOT is set, the value is used as the
root directory for all stage names rather than the default slash (/). If
the environment variable COMP_TARGET_ROOT is set, the value is used as the
root directory for all include and library names rather than the default
slash (/). COMP_TARGET_ROOT affects the standard directory for include
files, /usr/include, and the standard library, /usr/lib/libc.a. If
COMP_TARGET_ROOT is set, COMP_TARGET_ROOT/usr/lib is the only directory
that is searched for libraries using the -l x option.
If the environment variable TMPDIR is set, the value is used as the
directory to hold any temporary files rather than the default /tmp
directory.
If the environment variable RLS_ID_OBJECT is set and a link occurs, the
value is used as the name of an object to link. The RLS_ID_OBJECT variable
is always the last object specified to the linker.
Language Mode Options
The cxx command supports the following Language Mode options. For detailed
information about language modes, see Using Compaq C ++ for Tru64 UNIX
Systems .
-std ansi (cxx -newcxx only)
Use this option if you want an ANSI C++ compiler that
supports some commonly used extensions and is somewhat less
strict than the standard. This is the default compiler
mode. If you find that the compiler generates too many
diagnostics in this mode, you can use the -msg_quiet option
to relax error checking. This option also defines the macro
__STD_ANSI .
-std arm (cxx -newcxx only)
Use this mode if you want to compile programs developed
using C++ Version 5.n and want to minimize source changes.
This option also defines the macro __STD_ARM .
If you usually want your compilations done in this mode and
don't want to specify -std arm on each cxx command, define
the environment variable DEC_CXX as follows:
setenv DEC_CXX "-std arm"
-std cfront (cxx -newcxx only)
Use this option if you want to compile programs developed
using cfront or a compiler based on cfront. This option
also defines the macro __STD_CFRONT .
-std ms (cxx -newcxx only)
Use this option if you want the compiler to accept
additional Microsoft Visual C++ extensions. This option also
defines the macro __STD_MS .
-std strict_ansi (cxx -newcxx only)
Use this option if you want the compiler to enforce the ANSI
C++ standard strictly. The default ANSI mode permits some
common extensions and provides less strict error checking
than the STRICT_ANSI mode. This option also defines the
macro __STD_STRICT_ANSI .
-std strict_ansi_errors (cxx -newcxx only)
Use this option if you want STRICT_ANSI and also want errors
to be issued for all ANSI violations. -std strict_ansi
reports warnings for some ANSI violations. This option also
defines the macro __STD_STRICT_ANSI_ERRORS .
Message Information and Control Options
The cxx command supports the following message control options.The options
apply only to discretionary, warning, and informational messages. The tag
variable can be the keyword all , a tag obtained from the -msg _display _tag
option, or a number obtained from the -msg _display _number option.
-msg_inform tag ,... (cxx -newcxx only)
Alter message(s) severity to informational.
-msg_warn tag ,... (cxx -newcxx only)
Alter message(s) severity to warning.
-msg_error tag ,... (cxx -newcxx only)
Alter message(s) severity to error.
-msg_enable tag ,... (cxx -newcxx only)
Enable specific messages that would normally not be issued
when using -msg_quiet. This option can also be used to
enable messages disabled with -msg_disable.
-msg_disable tag ,... (cxx -newcxx only)
Disable message. Can be used for any non-error message.
-msg_quiet (cxx -newcxx only)
Be more like C++ V5.n error reporting. Fewer messages are
issued using this option.
This is the default in arm mode (-std arm). All other modes
default to -nomsg_quiet.
The msg_enable option can be used with this option to enable
specific messages normally disabled using -msg_quiet.
The cxx command supports the following message information options. Both
are off by default.
-msg_display_number (cxx -newcxx only)
Displays the error number at the beginning of each message.
Note that "D" (meaning discretionary) indicates that the
severity of the message can be controlled from the command
line. The message number can be used as the tag in the
message control options. If "D" is not displayed with the
message number, any attempt to control the message is
ignored.
-msg_display_tag (cxx -newcxx only)
Displays a more descriptive tag at the end of each message.
D" indicates the severity of the message can be controlled
from the command line. The tag displayed can be used as the
tag in the above message control options.
Note that you can also change the severity of a diagnostic
message if the message is discretionary. For example,
-msg_inform 110 changes the severity of message 110 to an
informational. These options interact with -w0, -w1, and
-w2.
Standard Library Options
The following are Standard Library options. For detailed information about
the Standard Library, see Using Compaq C ++ for Tru64 UNIX .
-nocxxstd (cxx -newcxx only)
Instructs the driver not to include libcxxstd.a when
linking.
-norpath (cxx -newcxx only)
Instructs the driver not to add an rpath for the location of
the C++ libraries. An application produced with this option
uses the installed C++ libraries when run. This is the
default for Tru64 UNIX 4.0F or higher.
-[no]use_system_libcxx (cxx -newcxx only)
Instructs the driver to link with the C++ libraries
installed on the system. Implies -norpath . This is the
default for Tru64 UNIX 4.0F and higher.
-[no]using_std (cxx -newcxx only)
Controls whether standard library header files are processed
as if the compiled code were written:
#include <header>
using namespace std;
This option is provided for compatibility for users who do
not want to qualify use of each standard library name with
std:: or put "using namespace std" at the top of their
sources.
-using_std turns implicit using namespace std on; this is
the default when compiling -std arm, -std cfront, -std ms,
or -std ansi.
-nousing_std turns implicit using namespace std off; this is
the default when compiling -std strict_ansi or -std
strict_ansi_errors.
To access the Standard Library reference pages, type man cxxstdlib_intro .
To access the Class Library reference pages, type man cxxlib_intro .
Precompiled Header Options
The cxx command supports the following precompiled header options. For
detailed information about precompiled headers, see Using Compaq C ++ for
Tru64 UNIX .
-create_pch file -name (cxx -newcxx only)
If other conditions are satisfied, create a precompiled
header file with the specified name. If -pch (automatic PCH
mode) or -use_pch appears on the command line following this
option, the last option is used. This option also defines
the macro __PCH_ENABLED .
-pch (cxx -newcxx only)
Automatically use and/or create a precompiled header file.
If -use_pch or -create_pch (manual PCH mode) appears on the
command line following this option, the last option is used.
This option also defines the macro __PCH_ENABLED .
-pch_dir dir (cxx -newcxx only)
Specifies the directory in which to search for and/or create
a precompiled header file. This option can be used with
automatic PCH mode (-pch) or manual PCH mode (-create_pch)
or -use_pch.
-[no]pch_messages (cxx -newcxx only)
Enable or disable the display of a message indicating that a
precompiled header file was created or used in the current
compilation. The default is -pch_messages.
-use_pch file -name (cxx -newcxx only)
Use a precompiled header file of the specified name as part
of the current compilation. If -pch (automatic PCH mode) or
-create_pch appears on the command line following this
option, the last option is used. This option also defines
the macro __PCH_ENABLED .
Template Options
The cxx command supports the following options for the instantiation of
templates. For detailed information about templates, see Using Compaq C ++
for Tru64 UNIX .
-define_templates, -tall
Instantiate all template entities declared or referenced in
the compilation unit. For each fully instantiated template
class, all its member functions and static data members are
instantiated even if they were not used. Nonmember template
functions are instantiated even if the only reference was a
declaration. Instantiations are created with external
linkage. Overrides -pt at compile time. Instantiations are
placed in the user's .o file.
-Hf Stops the cxx command after the prelinker runs and before
the final link. Provided for compatibility with previous
versions of C++. This option has no effect with the Version
6.n compiler.
-[no]implicit_include (cxx -newcxx only)
Effective only with Version 6.0 and later. Enable or disable
inclusion of source files as a method of finding definitions
of template entities. Implicit inclusion is enabled by
default, and it is disabled when compiling with -E or -P.
The search rules for finding template definition files are
the same as for include files. This option also defines the
macro __IMPLICIT_INCLUDE_ENABLED .
You might want to disable implicit inclusion with the -ms
and -std ms options to match the behavior on Microsoft C++
more closely.
-nopt Directs the compiler not to instantiate templates
automatically.
-nopragma_template
Directs the compiler to ignore any #pragma define_template
directives. This option is provided for users who want to
migrate quickly to automatic instantiation without having to
remove all the pragma directives from their code base.
-pt Directs the compiler to instantiate templates automatically.
This option is the default. Instantiations are placed in the
repository.
-ptr dir Specifies a repository, with ./cxx_repository as the
default. If you specify several repositories, only the first
is writable, and the rest are read only. Read-only
repositories are used only at link time.
Specifying this option at link time enables C++ to recognize
and use the template instantiation information files within
the specified repository. If you use this option, make sure
that the repository specified at compile time is the same
one specified at link time.
-ptsuf Specifies a list of file name suffixes that are valid for
template definition files. Items in the list must be
separated by commas and each suffix preceded by a period. A
suffix may have no more than eight characters excluding the
beginning period. The default is
".cxx,.CXX,.C,.cc,.CC,.cpp,.c".
-ptv Turns on verbose or verify mode to display each phase of
instantiation as it occurs. This option is useful as a
debugging aid.
-tall_repository (cxx -newcxx only)
Instantiate all templates declared or used in the source
program and put the object code generated as separate object
files in the repository. Instantiations caused by manual
instantiation directives are also put in the repository.
This is similar to -tall except that explicit instantiations
are also put in the repository, rather than an external
symbol being put in the main object file. This option is
useful for creating a pre-instantiation library.
-timplicit_local (cxx -newcxx only)
Generate explicit template instantiations as external
symbols in the users object file, but generate any template
instantiations that are used with internal linkage. Similar
to -tlocal , except that manual instantiations in the source
file receive external linkage. This is useful for build
systems that need to have explicit control of the template
instantiation mechanism. Having implicitly generated
template instantiations with internal linkage can cause
larger object file sizes.
-tlocal Similar to -tused except that the functions are given
internal linkage. This option provides a simple mechanism
for getting started with templates. The compiler
instantiates as local functions the functions used in each
compilation unit, and the program links and run correctly
(barring problems resulting from multiple copies of local
static variables). However, because many copies of the
instantiated functions can be generated, this option might
not be not suitable for production use.
Note that -t_local cannot be used in conjunction with
automatic template instantiation. If automatic
instantiation is enabled by default, it is disabled by the
-t_local option. If automatic instantiation is not enabled
by default, use of -t_local and -pt is an error.
-ttimestamp (cxx -newcxx only)
Used with automatic instantiation. Causes automatic
instantiation to instantiate templates only if they are not
already in the repository, or if the existing instantiations
in the repository are older than the timestamp in the
repository.
-tused Instantiate those template entities that were used in the
compilation. Overrides -pt at compile time.
-tused_repository (cxx -newcxx only)
Like -tall_repository , but instantiates only templates used
by the compilation. The explicit instantiations are also
put into the repository as separate object files.
Examples
This section provides usage examples.
% cxx -g -DUSE_CONCENTRATOR -o netmud netmud.cxx
This example creates an executable file named netmud with symbol table
information for full symbolic debugging (-g ). The -D option defines the
macro name USE_CONCENTRATOR for the preprocessor.
% cxx -o gfview -I/usr/kafka/src:/usr/barnes/include gfview.cxx
The above command line creates an executable file from the gfview.cxx
source file. The -o option names the output file gfview. The -I option
directs the preprocessing phase to search the specified directories for
include files not found in the current working directory.
% cxx -c io_module.cxx
This example preprocesses and compiles the source file io_module.cxx and
produces an object file named io_module.o. Processing stops after creating
the object file.
% cxx -o newsreader io_module.o ui.cxx -L/users/dave -lnews
This example creates an executable file, and the -o option names the file
newsreader. The source file ui.cxx is preprocessed and compiled, and then
linked with the object file io_module.o. The link operation uses the
library specified by -l (libnews.a). The linker first looks for the
library in the current working directory, then in the directory specified
by -L (/users/dave), and finally in $PATH.
% cxx -pg a.cxx b.cxx -no_pg c.cxx
This command line enables gprof profiling for files a.cxx and b.cxx and
disables profiling for file c.cxx.
Diagnostics
The error messages produced by the cxx compiler are self-explanatory. The
line number and file name where the error occurred are printed along with
the diagnostic.
Files
file.cxx C++ source code input file
file.o Object file
a.out Default output file
/usr/include
/usr/include/cxx
Standard directories for include files
See Also
asctime(3) , cxxlib_intro(3),
cxxstdlib_intro(3) , demangle(1) ,
ladebug(1) ,
ld(1) ,
pixie(5) ,
prof(1) ,
what(1) , and the DIGITAL UNIX Programmer's
Guide .