NAME
CC - C++ compiler
SYNOPSIS
CC [-386] [-486] [-a] [-B{dynamic|static|symbolic}] [-c]
[-cg{89|92}] [-compat[={4|5}]] [+d] [-Dname[=def]]
[-d{y|n}] [-dalign] [-dryrun] [-E] [+e{0|1}]
[-erroff[=t[,t...]]] [-errtags[=a]]
[-errwarn[=t[,t...]]] [-fast] [-features=a[,a...]]
[-filt[=filter[,filter...]] [-flags] [-fnonstd]
[-fns[={yes|no}]] [-fprecision=a] [-fround=a]
[-fsimple[=n]] [-fstore] [-ftrap=a[,a...]] [-G] [-g]
[-g0] [-H] [-h[ ]lname] [-help] [-Ipathname] [-I-] [-i]
[-inline] [-instances=i] [-instlib=file] [-KPIC]
[-Kpic] [-keeptmp] [-Lpath] [-llib] [-libmieee]
[-libmil] [-library=lib[,lib...]] [-mc] [-migration]
[-misalign] [-mr[,string]] [-mt] [-native] [-noex]
[-nofstore] [-nolib] [-nolibmil] [-noqueue]
[-norunpath] [-O[n]] [-O[level]] [-o file] [+p] [-P]
[-p] [-pentium] [-pg] [-PIC] [-pic] [-pta] [-ptipath]
[-pto] [-ptrpath] [-ptv]
[{-Qoption|-qoption}phase[,option...]]
[{-Qproduce|-qproduce}type] [-qp] [-Rpath[:path...]]
[-readme] [-S] [-s] [-sb] [-sbfast]
[-staticlib=l[,l...]] [-sync_stdio=[yes|no]]
[-temp=path] [-template=a[,a...]] [-time] [-Uname]
[-unroll=n] [-V] [-v] [-vdelx] [-verbose=a[,a...]]
[+w] [+w2] [-w] [-Xm] [-xa] [-xalias_level[=n]] [-xar]
[-xarch=isa] [-xautopar] [-xbinopt={a}]
[-xbuiltin[={%all|%none}]] [-xcache=c] [-xcg{89|92}]
[-xchar[=o]] [-xcheck[=n]] [-xchip=c] [-xcode=v]
[-xcrossfile[=n]] [-xdebugformat=[stabs|dwarf]]
[-xdepend[={yes|no}]] [-xdumpmacros[=value[,value...]]
[-xe] [-xF] [-xhelp={flags|readme}] [-xia]
[-xinline[=func_spec[,func_spec...]] [-xipo[={0|1|2}]
[-xjobs=n] [-xlang=language[,language]] [-xldscope={v}]
[-xlibmieee] [-xlibmil] [-xlibmopt] [-xlic_lib=sunperf]
[-xlicinfo] [-xlinkopt[=level]] [-xM] [-xM1] [-xMerge]
[-xmaxopt[=v]] [-xmemalign=ab] [-xmodel=[a]]
[-xnativeconnect[=n]] [-xnolib] [-xnolibmil] [-xnolib-
mopt] [-xOn] [-xopenmp] [-xpagesize=n]
[-xpagesize_heap=n] [-xpagesize_stack=n] [-xpch=v]
[-xpchstop] [-xpg] [-xport64[=v]] [-xprefetch[=a[,a]]
[-xprefetch_auto_type=[a] [-xprefetch_level[=l]]
[-xprofile=p] [-xprofile_ircache[=path]]
[-xprofile_pathmap=collect_prefix:use_prefix]
[-xregs=r[,r...]] [-xrestrict[=f]] [-xs] [-xsafe=mem]
[-xsb] [-xsbfast] [-xspace] [-xtarget=t]
[-xthreadvar[=o]] [-xtime] [-xtrigraphs[={yes|no}]]
[-xunroll=n] [-xustr={ascii_utf16_ushort|no}]
[-xvector[=a]] [-xvis] [-xwe] [-Yc,path] [-z arg]
[file] ...
Sun Studio 11: C++ 5.8 Compiler
A man page, by definition, is a quick reference. For more
detailed information on the C++ compiler and its options,
see the C++ User's Guide.
See the online readme file, viewable by calling
CC -xhelp=readme
for the latest important information on platforms, environ-
ments, new features, and software corrections.
Access all the installed Sun compilers and tools documenta-
tion, including readme files, user guides, and reference
manuals by pointing an HTML browser to the default installa-
tion directory:
file:/opt/SUNWspro/docs/index.html
Note - If your Sun compilers and tools are not installed in
the default /opt directory, ask your system administrator
for the equivalent path on your system.
New Features
This section describes the new and changed features for the
Sun Studio 11: C++ 5.8 compiler. See the Sun Studio 11 C++
User's Guide for more detailed descriptions of the new
features.
o New -xarch Flags For x86 Development
The -xarch option now supports the following new flags
for development on the x86 platform: amd64a,
pentium_proa, ssea, sse2a. See the -xarch option
description in this man page for more information.
o Support For x86 -xpagesize Options
The -xpagesize, -xpagesize_heap, -xpagesize_stack
options are now enabled for x86 platforms as well as
SPARC.
o A New -xmodel Option To Specify x86 Memory Models
The new -xmodel option lets you specify the kernel,
small, or medium memory models on the 64-bit AMD archi-
tecture. If the size of your global and static vari-
ables exceeds two gigabytes, specify -xmodel=medium.
Otherwise, use the default -xmodel=small setting. See
the -xmodel option description in this man page for
more information.
o Support For SSE/SSE2 Integral Media Intrinsics
This release supports intrinsic functions for SSE2
128-bit XMM register integral media-instructions.
Include the sunmedia_intrin.h header file in the source
code and specify the -xbuiltin option to take advantage
of these functions. Furthermore, these intrinsic func-
tions require SSE2 support so specify options such as
-xarch=sse2, -xarch=amd64, or -xtarget=opteron.
Essentially, the compiler generates inline code for
these instrinsic functions. This is easier than manipu-
lating the instructions through assembly language and
it can be optimized by the compiler.
For more information about intrinsics, explanations for
the function prototypes contained in the header files,
and the data types used by these functions, see the
'Intel C++ Intrinsics Reference' section of the
Intel(R) C++ Compiler for Linux Systems manual.
o New -xvector Flags for x86 SSE2 Platforms
The -xvector option enables automatic generation of
calls to the vector library functions and/or the gen-
eration of the SIMD (Single Instruction Multiple Data)
instructions.
See the -xvector option description in this man page
for more information.
o Binary Optimizer for SPARC
A new -xbinopt option allows the compiler to prepare
the binary file for further optimization by the
binopt(1) binary optimizer.
o Calling Dependent Static Functions From a Function Template
The C++ standard says that function calls that depend
on a template parameter can refer only to visible func-
tion declarations having external linkage. Specify
-features=[no%]tmplrefstatic if your application code
depends on the compiler ignoring this rule and calling
a dependent static function from a function template.
See the C++ User's Guide for examples of
-features=[no%]tmplrefstatic.
o New SPARC -xtarget and -xchip Values
The new -xtarget flags ultra3iplus, ultra4plus, and
ultraT1 along with the new -xchip flags ultra3iplus,
ultra4plus, and ultraT1 provide code generation for the
UltraSPARC IIIiplus, UltraSPARC T1, and UltraSPARC
IVplus processors.
o A New Format For Debugger Information
The C++ compiler can now generate debugger information
in the dwarf format. The default is still the stabs
format, but you can generate dwarf data by setting the
new option -xdebugformat to -xdebugformat=dwarf.
o Enhancements to the STACKSIZE Environment Variable
The syntax of the STACKSIZE environment variable has
been enhanced to accept a units keyword for denoting
the slave thread stacksize: B for Bytes, K for Kilo-
bytes, M for Megabytes, G for Gigabytes.
For example, setenv STACKSIZE 8192 sets the slave
thread stack size to 8 MB. 1235B sets the slave thread
stack size for for 1235 Bytes. 1235G sets it for 1235
Gigabytes. The default for an integer value without a
suffix letter is still Kilobytes.
o OpenMP Autoscoping
Autoscoping is now available for C++ programs. This
feature is described in chapter 3 of the Sun Studio
OpenMP API User's Guide.
New Features In Sun Studio 10
This section describes the new and changed features for the
Sun Studio 10: C++ 5.7 compiler. See the C++ readme or the
Sun Studio 10 C++ User's Guide for more detailed descrip-
tions of these new features.
o A new -xarch option, -xarch=amd64, specifies compilation
for the 64-bit AMD instruction set.
o A new -xtarget option, -xtarget=opteron, specifies the
-xarch, -xchip, and -xcache settings for 32-bit AMD compila-
tion.
o A new x86-only flag for the -xregs option,
-xregs=[no%]frameptr, lets you use the frame-pointer regis-
ter as an unallocated callee-saves register to increase the
run-time performance of applications.
o The C++ compiler now predefines __amd64 and __x86_64 when
you specify -xarch=amd64.
o The existing -xarch=generic64 option now supports the x86
platform in addition to the traditional SPARC platform.
o The compiler now supports template-template parameters.
This means that you can specify a template definition with
parameters that are themselves templates, rather than types
or values. For more information, see the C++ readme or the
Sun Studio 10 C++ User's Guide.
o The compiler, in default standard mode, now allows nested
classes to access private members of the enclosing class. To
restore the old compiler behavior, disallowing the access,
specify -features=no%nestedaccess. The default is
-features=nestedaccess. For more information, see the C++
readme or the Sun Studio 10 C++ User's Guide.
Overview of the C++ Compiler
CC converts C++ and assembly source files to object files,
and links object files and libraries into executable pro-
grams.
Programs that contain C++ objects must be linked with CC.
CC takes arguments ending in .c, .C, .cc, .cxx, .c++, .cpp,
or .i to be C++ source programs. Arguments ending in .s are
presumed to be assembly source files. Arguments ending in
.o are presumed to be object files.
Files whose names do not end with the above suffixes are
treated as object programs or libraries and are handed over
to the link editor. Unless -c, -S, -E, or -P is specified,
these programs and libraries, together with the results of
any specified compilations or assemblies, are linked in the
order given to produce an output file named a.out. You can
specify a different name for the executable by using the -o
option.
If a single file is compiled and linked all at once, the
intermediate files are deleted.
Before you use the CC command, insert into your search path
the name of the directory in which you have chosen to
install the C++ compilation system. For instructions on set-
ting your search path, see the csh(1) or the sh(1) man page.
COMPILING FOR 64-BIT:
This version of the compiler can produce 64-bit object
binaries on 32-bit or 64-bit Solaris platforms. The result-
ing executable will run only on 64-bit SPARC UltraSPARC(R)
or x86 processors under Solaris OS with the 64-bit kernel.
Compilation, linking, and execution of 64- bit objects can
only take place in a Solaris OS environment that supports
64-bit execution.
The 64-bit Solaris OS provides support for 64-bit integer
and pointer data as well as support for large files and
large arrays.
On SPARC Platforms:
Compiling for a 64-bit Solaris OS on SPARC platforms is
indicated by one of the variants of the -xarch=v9 option.
You must specify one of these options even if you also
specify -xtarget or -fast. In such a case, the -xarch=v9
option must appear after any -xtarget or other option that
sets -xarch. For example:
-xtarget=ultra -xarch=v9
Note that -xtarget=ultra, -xtarget=ultra2, and
-xtarget=ultra3 imply -xarch=v8 and do not automatically
cause 64-bit compilations.
If you are building shared dynamic libraries with -xarch=v9,
v9a, or v9b in a 64-bit Solaris OS, you must specify
-xcode=pic13 or -xcode=pic32. -xcode=abs44 will not work.
See the -xcode option for information on how to specify code
address sizes.
For general information on 64-bit Solaris software for
software developers, see the "Solaris 64-bit Developer's
Guide" on http://docs.sun.com .
For more specific information regarding the migration of C
programs to a 64-bit environment, see the C User's Guide.
On x86 Platforms
On x86 platforms, -xarch=amd64 specifies compilation for the
64-bit AMD instruction set.
A new -xtarget option, -xtarget=opteron, specifies the
-xarch, -xchip, and -xcache settings for 32-bit AMD compila-
tion.
You must specify -xarch=amd64 after -fast and -xtarget on
the command line to generate 64-bit code. The new
-xtarget=opteron option does not automatically generate 64-
bit code. It expands to -xarch=sse2, -xchip=opteron, and
-xcache=64/64/2:1024/64/16 which result in 32-bit code. The
-fast option also results in 32-bit code because it is a
macro which also defines an -xtarget value. All the current
-xtarget values result in 32-bit code so be sure to specify
-xarch=amd64 after (to the right of) -fast or -xtarget if
you want to compile 64-bit code, as in:
CC -fast -xarch=amd64or CC -xtarget=opteron -xarch=amd64
Also, the existing -xarch=generic64 option now supports the
x86 platform in addition to the traditional SPARC platform.
The compilers now predefine __amd64 and __x86_64 when you
specify -xarch=amd64.
OPTIONS
In general, compiler options are processed from left to
right (with the exception that the -U options are processed
after all -D options), allowing selective overriding of
macro options (options that include other options). This
rule does not apply to linker options.
For a complete description of the C++ compiler options,
including examples, see the C++ User's Guide.
CC accepts the following options.
-386 (x86 platform) Use -xtarget=386.
-486 (x86 platform) Use -xtarget=486.
-a Use -xa.
See also:
tcov(1) man page
-Bbinding Specifies whether a library binding for linking is
symbolic, dynamic (shared), or static (nonshared).
-Bdynamic is the default. You can use the -B
option several times on a command line.
For more information on the -Bbinding option, see
the ld(1) man page and the Solaris documentation.
-Bdynamic directs the link editor to look for
liblib.so files. Use this option if you want
shared library bindings for linking. If the
liblib.so files are not found, it looks for
liblib.a files.
-Bstatic directs the link editor to look only for
liblib.a files. The .a suffix indicates that the
file is static, that is, nonshared. Use this
option if you want nonshared library bindings for
linking.
-Bsymbolic forces symbols to be resolved within a
shared library if possible, even when a symbol is
already defined elsewhere. For an explanation of
-Bsymbolic, see the ld(1) man page.
This option and its arguments are passed to the
linker, ld. If you compile and link in separate
steps and are using the -Bbinding option, you must
include the option in the link step.
Warning:
Never use -Bsymbolic with programs containing C++
code, use linker scoping instead. See the C++
User's Guide for more information on linker scop-
ing. See also the -xldscope option.
With -Bsymbolic, references in different modules
can bind to different copies of what is supposed
to be one global object.
The exception mechanism relies on comparing
addresses. If you have two copies of something,
their addresses won't compare equal, and the
exception mechanism can fail because the exception
mechanism relies on comparing what are supposed to
be unique addresses.
-c Directs the CC driver to suppress linking with ld
and, instead, produce a .o file for each source
file. If you specify only one source file on the
command line, then you can explicitly name the
object file with the -o option. For example:
o If you enter CC -c x.cc, the object file,
x.o, is generated.
o If you enter CC -c x.cc -o y.o, the object
file, y.o, is generated.
Warnings:
When the compiler produces object code for an
input file (for example, .cc, .c, or .i), the com-
piler always produces a .o file in the working
directory. If you suppress the linking step, the
.o files are not removed.
See also:
-o filename.
-cg{89|92}
Use -xcg{89|92}.
See also:
-xtarget=native
-compat[={4|5}]
Sets the major release compatibility mode of the
compiler. This option controls the __cplusplus
and __SUNPRO_CC_COMPAT preprocessor symbols.
The C++ compiler has two principal modes. The com-
patibility mode accepts the Annotated C++ Refer-
ence Manual (ARM) semantics and language defined
by the 4.2 compiler (-compat[=4]). The standard
mode accepts constructs according to the ANSI/ISO
standard (standard mode, -compat=5). These two
modes are incompatible with each other because the
ANSI/ISO standard forces significant, incompatible
changes in name mangling, vtable layout, and other
ABI details. These two modes are differentiated by
the -compat option as shown in the following
table.
Value Meaning
-compat[=4] (Compatibility mode) Set language
and binary compatibility to that of
the 4.0.1, 4.1, and 4.2 compilers.
Sets the __cplusplus preprocessor
macro to 1 and the
__SUNPRO_CC_COMPAT preprocessor
macro to 4).
-compat=5 (Standard mode) Set the language
and binary compatibility to
ANSI/ISO standard mode. Sets the
__cplusplus preprocessor macro to
199711L and the __SUNPRO_CC_COMPAT
preprocessor macro to 5).
Defaults:
If the -compat option is not specified, -compat=5
is assumed. If only -compat is specified, -com-
pat=4 is assumed.
Interactions:
You cannot use the standard libraries in compati-
bility mode (-compat[=4]).
Use of -compat[=4] with any of the following
options is not supported.
o -Bsymbolic
o -features=[no%]strictdestorder
o -features=[no%]tmplife
o -library=[no%]iostream
o -library=[no%]Cstd
o -library=[no%]Crun
o -library=[no%]rwtools7_std
o -xarch=v9
o -xarch=v9a
o -xarch=v9b
Use of -compat=5 with any of the following options
is not supported.
o -Bsymbolic
o +e
o -features=[no%]arraynew
o -features=[no%]explicit
o -features=[no%]namespace
o -features=[no%]rtti
o -library=[no%]complex
o -library=[no%]libC
o -vdelx
Warnings:
When building a shared library do not use -Bsym-
bolic.
+d Prevents the compiler from expanding C++ inline
functions.
Under the C++ language rules, a C++ inline func-
tion is a function for which one of the following
statements is true.
o The function is defined using the inline key-
word.
o The function is defined (not just declared)
inside a class definition
o The function is a compiler-generated class
member function
Under the C++ language rules, the compiler can
choose whether actually to inline a call to an
inline function. The C++ compiler inlines calls to
an inline function unless:
o The function is too complex
o The +d option is selected
o The -g option is selected
Interactions:
This option is automatically turned on when you
specify -g, the debugging option.
The -g0 debugging option does not turn on +d.
The +d option has no effect on the automatic
inlining that is performed when you use -x04 or
-x05.
-Dname[=def]
Defines a macro symbol name to the preprocessor.
Doing so is equivalent to including a #define
directive at the beginning of the source. You can
use multiple -D options.
The following values are predefined.
SPARC and x86 platforms:
__BUILTIN_VA_ARG_INCR
__cplusplus
__DATE__
__FILE__
__LINE__
__STDC__ = 0
__SVR4
__SUNPRO_CC = 0x580
__SUNPRO_CC_COMPAT = 4 or 5
__sun
sun
__TIME__
__`uname -s`_`uname -r` (replacing invalid charac-
ters with underscores, for example: -D__SunOS_5_8,
-D__SunOS_5_9)
__unix
unix
_WCHAR_T
__ARRAYNEW if the "array" forms of operators new
and delete are enabled
(see "-features=[no%]arraynew")
_BOOL if type bool is enabled
(see "-features=[no%]bool")
SPARC only:
__SUN_PREFETCH = 1
__sparc
sparc
SPARC V9 only:
__sparcv9 (64-bit compilation modes only)
x86 only:
__i386
i386
__amd64
__x86_64
Defaults:
If you do not use [=def], name is defined as 1.
Interactions:
If +p is used, sun, unix, sparc and i386 are not
defined.
-d{y|n} Allows or disallows dynamic libraries for the
entire executable.
-dy specifies dynamic linking, which is the
default, in the link editor.
-dn specifies static linking in the link editor.
This option and its arguments are passed to ld.
Interactions:
This option causes fatal errors if you use it in
combination with dynamic libraries. Most system
libraries are only available as dynamic libraries.
-dalign (SPARC) -dalign is equivalent to -xmemalign=8s.
For more information, see -xmemalign.
-dryrun Directs the CC driver to show, but not execute,
the commands constructed by the compilation
driver.
-E Directs the CC driver to only preprocess the C++
source files, and to send the result to stdout
(standard output). No compilation is done; no .o
files are generated.
This option causes preprocessor-type line number
information to be included in the output.
Output from this option is not supported as input
to the C++ compiler when templates are used.
+e{0|1} Controls virtual table generation in compatibility
mode (-compat[=4]). This option is invalid and
ignored in standard mode (the default mode).
Values:
o +e0 suppresses the generation of virtual tables,
and creates external references to those that
are needed.
o +e1 creates virtual tables for all defined
classes with virtual functions.
Interactions:
When you compile with this option, also use the
-features=no%except option. Otherwise the com-
piler generates virtual tables for internal
types used in exception handling.
If template classes have virtual functions,
ensuring that the compiler generates all needed
virtual tables, but does not duplicate these
tables, might not be possible.
-erroff[=t[,t...] ]
Suppresses compiler warning messages but has no
effect on error messages. This option applies to
all warning messages whether or not they have been
designated by -errwarn to cause a non-zero exit
status.
Values:
The -erroff values are members of a comma-
separated list that consists of one or more of the
following:
tag Suppresses the warning message specified
by this tag. You can display the tag for
a message by using the -errtags=yes
option.
no%tag Enables the warning message specified by
this tag.
%all Suppresses all warning messages.
%none Enables all warning messages. This is the
default.
Order is important; for example, %all,no%tag
suppresses all warning messages except tag.
Defaults:
The default is -erroff=%none. Specifying -erroff
is equivalent to specifying -erroff=%all.
Warnings:
Only warning messages from the C++ compiler
front-end that display a tag when the -errtags
option is used can be suppressed with the -erroff
option.
-errtags [ = a]
Displays the message tag for each warning message
of the C++ compiler front-end that can be
suppressed with the -erroff option or made a fatal
error with the -errwarn option. Messages from the
C++ compiler driver and other components of the
C++ compilation system do not have error tags and
cannot be suppressed with -erroff and made fatal
with -errwarn.
Values and Defaults:
a can be either yes or no. The default is
-errtags=no. Specifying -errtags is equivalent to
specifying -errtags=yes.
-errwarn [ = t[,t...]]
Use the -errwarn option to cause the C++ compiler
to exit with a failure status for the given warn-
ing messages.
Values:
t is a comma-separated list that consists of one
or more of the following: tag, no%tag, %all,
%none. Order is important; for example %all,no%tag
causes the C++ compiler to exit with a fatal
status if any warning except tag is issued.
The following table details the -errwarn values:
tag Cause CC to exit with a fatal status if
the message specified by tag is issued as
a warning message. Has no effect if tag
in not issued.
no%tag Prevent CC from exiting with a fatal
status if the message specified by tag is
issued only as a warning message. Has no
effect if tag is not issued. Use this
option to revert a warning message that
was previously specified by this option
with tag or %all from causing CC to exit
with a fatal status when issued as a
warning message.
%all Cause CC to exit with a fatal status if
any warning messages are issued. %all can
be followed by no%tag to exempt specific
warning messages from this behavior.
%none Prevents any warning messages from caus-
ing CC to exit with a fatal status should
any warning tag be issued. This is the
default.
Defaults:
The default is -errwarn=%none. If you specify
-errwarn alone, it is equivalent to -errwarn=%all.
Warnings:
The warning messages generated by the C++ compiler
change from release to release as the compiler
error checking improves and features are added.
Code that compiles using -errwarn=%all without
error may not compile without error in the next
release of the compiler.
Only warning messages from the C++ compiler
front-end that display a tag when the -errtags
option is used can be specified with the -errwarn
option to cause the C++ compiler to exit with a
failure status.
See Also:
-erroff, -errtags
-fast This option is a macro that you can effectively
use as a starting point for tuning an executable
for maximum run-time performance. The expansion of
-fast can change from one release of the compiler
to the next and includes options that are target
platform specific. Use the -# or the -xdryrun
options to examine the expansion of -fast, and
incorporate the appropriate options of -fast into
the ongoing process of tuning the executable.
The expansion of -fast now includes the new -xlib-
mopt option. This option enables the compiler to
use a library of optimized math routines. For more
information, see the description of -xlibmopt in
this man page. This option provides near maximum
performance for most applications by expanding the
following compilation options:
-fns (SPARC, x86)
-fsimple=2 (SPARC, x86)
-nofstore (x86 only)
-xlibmil (SPARC, x86)
-xlibmopt (SPARC, x86)
-xmemalign (SPARC only)
-xO5 (SPARC, x86)
-xtarget=native (SPARC, x86)
-xbuiltin=%all (SPARC, x86)
Interactions:
The code generation option, the optimization
level, the optimization of built-in functions, and
the use of inline template files can be overridden
by subsequent flags. For example, although the
optimization level set by -fast is -xO5, if you
specify -fast, -xO3, the optimization level
becomes -xO3. The optimization level that you
specify overrides a previously set optimization
level.
The -fast macro expands into compilation options
that may affect other specified options. For exam-
ple, in the following command, the expansion of
the -fast macro includes -xtarget=native which
reverts -xarch to one of the 32-bit architecture
options.
Incorrect:
example% CC -xarch=v9 -fast test.cc
Correct:
example% CC -fast -xarch=v9 test.cc
See the description for each option to determine
possible interactions.
Warnings:
Code compiled with the -fast option is not port-
able. For example, compiling code using the fol-
lowing command on an UltraSPARC(TM) III system
will generate a binary that will not execute on an
UltraSPARC II system.
example% CC -fast test.cc
Do not use this option for programs that depend on
IEEE standard floating-point exception handling;
different numerical results, premature program
termination, or unexpected SIGFPE signals might
occur.
The -fast option includes -fns -ftrap=%none; that
is, this option turns off all trapping.
In previous SPARC releases, the -fast macro
included -fnonstd, now it does not.
In previous SPARC releases, the -fast macro
expanded to -fsimple=1. Now it expands to -fsim-
ple=2.
In previous releases, the -fast macro expanded to
-xO4. Now it expands to -xO5.
See also:
Numerical Computation Guide, ieee_sun(3m).
-features=a
Enables/disables various C++ language features.
The following flags are valid for both standard
mode (default) and compatibility mode (-com-
pat[=4]) unless otherwise specified.
Value Meaning
%all All the -feature options that are
valid for the specified mode (com-
patibility mode or standard mode).
%none Turn off all the features that can
be turned off for the specified
mode (compatibility mode or stan-
dard mode).
[no%]altspell [Do not] Recognize alternative
token spellings (for example, and
for &&). The default is
no%altspell in compatibility mode
and altspell in standard mode.
[no%]anachronisms
[Do not] Allow anachronistic con-
structs. When disabled (that is
-feature=no%anachronisms), no
anachronistic constructs are
allowed. The default is anachron-
isms.
[no%]arraynew (Compatibility mode only) [Do not]
Recognize array forms of operator
new and operator delete (for exam-
ple, operator new[] (void*) ). When
enabled, the macro __ARRAYNEW = 1.
When not enabled, the macro is not
defined. The default is
no%arraynew. For details on the use
of this flag, see the C++ Migration
Guide.
[no%]bool [Do not] Allow the bool type and
literals. When enabled, the macro
_BOOL = 1. When disabled, the macro
is not defined. The default is
no%bool in compatibility mode and
bool in standard mode.
[no%]conststrings
[Do not] Put literal strings in
read-only memory. The default is
no%conststrings in compatibility
mode and conststrings in standard
mode.
[no%]except [Do not] Allow C++ exceptions. When
C++ exceptions are disabled (that
is, -features=no%except), a throw-
specification on a function is
accepted but ignored; the compiler
does not generate exception code.
Note that the keywords try, throw,
and catch are always reserved. The
default is except.
[no%]explicit (Compatibility mode only) [Do not]
Recognize the keyword explicit.
The default is no%explicit.
[no%]export [Do not] Recognize the keyword
export. The default is no%export
in compatibility mode and export in
standard mode.
[no%]extensions
[Do not] Allow non-standard code
that is commonly accepted by other
C++ compilers. See chapter 4 of the
C++ User's Guide for an explanation
of the invalid code that is
accepted by the compiler when you
use the -features=extensions
option. The default is
-features=no%extensions.
[no%]iddollar [Do not] Allow $ as a non-initial
identifier character. The default
is no%iddollar.
[no%]localfor [Do not] Use new local-scope rules
for the for statement. The default
is no%localfor in compatibility
mode and localfor in standard mode.
[no%]mutable [Do not] Recognize the keyword mut-
able. The default is no%mutable in
compatibility mode and mutable in
standard mode.
[no%]namespace (Compatibility mode only) [Do not]
Recognize keywords namespace and
using. The default is
no%namespace.
The purpose of -features=namespace
is to aid in converting code to
standard mode. By enabling this
option, you get error messages if
you use these keywords as identif-
iers. The keyword recognition
options allow you to find uses of
the added keywords without having
to compile in standard mode.
[no%]nestedaccess
(Standard mode only) [Do not] Allow
nested classes to access private
members of the enclosing class.
[no%]rtti [Do not] Allow runtime type iden-
tification (RTTI). RTTI must be
enabled to use the dynamic_cast<>
and typeid operators. For -compat=4
mode, the default is no%rtti. Oth-
erwise, the default is
-features=rtti, and the option
-features=no%rtti is not allowed.
[no%]split_init
[Do not] Put initializers for non-
local static objects into indivi-
dual functions. When you use
-features=no%split_init, the com-
piler puts all the initializers in
one function. Using
-features=no%split_init minimizes
code size at the possible expense
of compile time. The default is
split_init.
[no%]strictdestorder
(Standard mode only) [Do not] Fol-
low the requirements specified by
the C++ standard regarding the
order of the destruction of objects
with static storage duration. The
default is strictdestrorder.
[no%]tmplife (Standard mode only) [Do not] Clean
up the temporary objects that are
created by an expression at the end
of the full expression, as defined
in the ANSI/ISO C++ Standard.
(When -features=no%tmplife is in
effect, most temporary objects are
cleaned up at the end of their
block.) The default is no%tmplife.
[no%]tmplrefstatic
[Do not] allow function templates
to refer to dependent static func-
tions or static function templates.
The default is the standard confor-
mant no%tmplrefstatic.
[no%]transitions
[Do not] allow ARM language con-
structs that are problematic in
standard C++ and that may cause the
program to behave differently than
expected or that may be rejected by
future compilers. When you use
-features=no%transitions, the com-
piler issues warnings about these
constructs instead of error mes-
sages. When you use
-features=transitions in compati-
bility mode (-compate[=4]), the
compiler displays the warnings
about these constructs only if +w
or -w2 is specified. The following
constructs are considered to be
transition errors: redefining a
template after it was used, omit-
ting the typename directive when it
is needed in a template definition,
and implicitly declaring type int.
The set of transition errors may
change in a future release. The
default is transitions.
Defaults:
If -features is not specified, the following is
assumed for compatibility mode (-compat[=4]):
-features=%none,anachronisms,except,split_init,transitions
If -features is not specified, the following is
assumed for standard mode (the default mode):
-features=%all,no%iddollar,no%extensions,no%tmplife
Interactions:
This option accumulates instead of overrides.
Use of the following in standard mode (the
default) is not compatible with the standard
libraries and headers:
o no%bool
o no%except
o no%mutable
o no%explicit
Warnings:
Be careful when you specify -features=%all or
-features=%none. The set of features can change
with each compiler release and with each patch.
Consequently, you can get unintended behavior.
The behavior of a program might change when you
use -features=tmplife. Testing whether the pro-
gram works both with and without the
-features=tmplife option is one way to test the
program's portability.
The compiler assumes -features=split_init by
default in compat mode (-compt=4). If you use the
-features=%none option to turn off other features,
you may find it desirable to turn the splitting of
initializers into separate functions back on by
using -features=%none,split_init instead.
-filt[=filter[,filter...]]
Suppress the filtering that CC normally applies to
linker error messages.
filter must be one of the following values
[no%]errors [Do not] Show the C++ explanations
of the linker error messages. The
suppression of the explanations is
useful when the linker diagnostics
are provided directly to another
tool.
[no%]names [Do not] Demangle the C++ mangled
linker names.
[no%]returns [Do not] Demangle the return types
of functions. Suppression of this
demangling helps you to identify
function names more quickly, but
note that in the case of co-variant
returns, some functions differ only
in the return type.
[ no% ] stdlib [Do not] Simplify names from the
standard library in both the linker
and compiler error messages. This
makes it easier for you to recog-
nize the name of standard-library
functions.
%all Equivalent to
-filt=errors,names,returns,stdlib.
This is the default behavior.
%none Equivalent to
-filt=no%errors,no%names,no%returns,no%stdlib.
Defaults:
If you do not specify the -filt option, or if you
specify -filt without any values, then the com-
piler assumes -filt=errors,names,returns,stdlib.
Interactions:
[no%]returns has no effect when used with
no%names. That is, the following options are
equivalent:
-filt=no%names
-filt=no%names,no%returns
-filt=no%names,returns
-flags Same as -xhelp=flags.
-fnonstd
This option causes hardware traps to be enabled
for floating-point overflow, division by zero, and
invalid operations exceptions.
These results are converted into SIGFPE signals.
If the program has no SIGFPE handler, it ter-
minates with a memory dump (unless you limit the
core dump size to 0).
SPARC: In addition, -fnonstd selects SPARC non-
standard floating point.
Defaults:
If -fnonstd is not specified, IEEE 754 floating-
point arithmetic exceptions do not abort the pro-
gram, and underflows are gradual.
Expansions:
x86: -fnonstd expands to -ftrap=common.
SPARC: -fnonstd expands to -fns -ftrap=common.
See -fns and -ftrap=common as well as the Numeri-
cal Computation Guide for more information.
-fns[={no|yes}]
For SPARC, this option causes the nonstandard
floating-point mode to be enabled when a program
begins execution.
For x86, this option selects SSE flush-to-zero
mode and, where available, denormals-are-zero
mode. This option causes subnormal results to be
flushed to zero on x86. Where available, this
option also causes subnormal operands to be
treated as zero. This option has no effect on
traditional x86 floating-point operations that do
utilize the SSE or SSE2 instruction set.
On some SPARC platforms, the nonstandard
floating-point mode disables "gradual underflow,"
causing tiny results to be flushed to zero rather
than to produce subnormal numbers. It also causes
subnormal operands to be silently replaced by
zero.
On those SPARC platforms that do not support gra-
dual underflow and subnormal numbers in hardware,
use of this option can significantly improve the
performance of some programs.
Optional use of =yes or =no provides a way of tog-
gling the -fns flag following some other macro
flag that includes -fns, such as -fast.
-fns is the same as -fns=yes.
-fns=yes selects non-standard floating point.
-fns=no selects standard floating point.
Defaults:
If -fns is not specified, the nonstandard
floating-point mode is not enabled automatically.
Standard IEEE 754 floating-point computation takes
place, that is, underflows are gradual.
If only -fns is specified -fns=yes is assumed.
Warnings:
When nonstandard mode is enabled, floating-point
arithmetic may produce results that do not conform
to the requirements of the IEEE 754 standard.
On SPARC systems, this option is effective only if
used when compiling the main program.
If you compile one routine with -fns, then compile
all routines of the program with the -fns option;
otherwise you can get unexpected results.
-fprecision=a
(x86 platform) Sets floating-point rounding preci-
sion mode. a must be one of: single, double,
extended.
The -fprecision flag sets the rounding precision
mode bits in the Floating Point Control Word.
These bits control the precision to which the
results of basic arithmetic operations (add, sub-
tract, multiply, divide, and square root) are
rounded.
The following table shows the meanings of the
values of a.
Value Meaning
single Rounds to an IEEE single-precision value
double Rounds to an IEEE double-precision value
extended Rounds to the maximum precision avail-
able
When a is single or double, this flag causes the
rounding precision mode to be set to single or
double precision, respectively, when a program
begins execution. When p is extended or the -fpre-
cision flag is not used, the rounding precision
mode remains as the extended precision.
The single precision rounding mode causes results
to be rounded to 24 significant bits, and double
precision rounding mode causes results to be
rounded to 53 significant bits. In the default
extended precision mode, results are rounded to 64
significant bits. This mode controls only the pre-
cision to which results in registers are rounded,
and it does not affect the range. All results in
register are rounded using the full range of the
extended double format. Results that are stored in
memory are rounded to both the range and precision
of the destination format.
The nominal precision of the float type is single.
The nominal precision of the long double type is
extended.
Defaults:
When the -fprecision flag is not specified, the
rounding precision mode defaults to extended.
Warnings:
This option is effective only on x86 devices and
only if used when compiling the main program. On
SPARC devices, this option is ignored.
-fround=a Sets the IEEE rounding mode in effect at startup.
a must be one of: nearest, tozero, negative,
positive.
Value Meaning
nearest Rounds towards the nearest number and
breaking ties to even numbers.
tozero Round-to-zero.
negative Round-to-negative-infinity.
positive Round-to-positive-infinity.
This option sets the IEEE 754 rounding mode that:
o Can be used by the compiler in evaluating con-
stant expressions.
o Is established at runtime during the program
initialization.
The meanings are the same as those for the
ieee_flags function, which may be used to change
the mode at runtime.
Defaults:
When the -fround option is not specified, the
rounding mode defaults to -fround=nearest.
Warnings:
If you compile one routine with -fround=a, compile
all routines of the program with the same
-fround=a option; otherwise, you can get unex-
pected results. This option is effective only if
used when compiling the main program.
-fsimple[=n]
Selects floating-point optimization preferences.
If n is present, it must be 0, 1 or 2.
The following table shows the -fsimple values.
Value Meaning
0 Permits no simplifying assumptions.
Preserves strict IEEE 754 conformance.
1 Allows conservative simplification. The
resulting code does not strictly conform
to IEEE 754, but numeric results of most
programs are unchanged.
With -fsimple=1, the optimizer is not
allowed to optimize completely without
regard to roundoff or exceptions. In
particular, a floating point computation
cannot be replaced by one that produces
different results with rounding modes
held constant at runtime.
With -fsimple=1, the optimizer can
assume the following:
o IEEE 754 default rounding/trapping
modes do not change after process ini-
tialization.
o Computation producing no visible
result other than potential floating-
point exceptions may be deleted.
o Computation with Infinity or NaNs as
operands need not propagate NaNs to
their results. For example, x*0 may be
replaced by 0.
o Computations do not depend on sign of
zero.
2 Enables use of SIMD instructions to com-
pute reductions when -xvector=simd is in
effect.
Permits aggressive floating point optim-
ization that may cause many programs to
produce different numeric results due to
changes in rounding. For example,
permits the optimizer to replace all
computations of x/y in a given loop with
x*z, where x/y is guaranteed to be
evaluated at least once in the loop,
z=1/y , and the values of y and z are
known to have constant values during
execution of the loop.
Defaults:
If -fsimple is not designated, the compiler uses
-fsimple=0.
If -fsimple is designated but no value is given
for n, the compiler uses -fsimple=1.
Warnings:
This option can break IEEE 754 conformance.
See Also:
Techniques for Optimizing Applications: High Per-
formance Computing written by Rajat Garg and Ilya
Sharapov for a more detailed explanation of how
optimization can impact precision.
-fstore (x86 platform) Forces precision of floating-point
expressions.
This option causes the compiler to convert the
value of a floating-point expression or function
to the type on the left side of an assignment -
when that expression or function is assigned to a
variable, or when that expression is cast to a
shorter floating-point type rather than leaving
the value in a register.
To turn off this option, use the -nofstore option.
Warnings:
Due to roundoffs and truncation, the results may
be different from those that are generated from
the register values.
-ftrap=a[,a...]
Sets the IEEE trapping mode in effect at startup
but does not install a SIGFPE handler. You can use
ieee_handler(3M) or fex_set_handling(3M) to simul-
taneously enable traps and install a SIGFPE
handler. If you specify more than one value, the
list is processed sequentially from left to right.
a must be one of the following values.
Value Meaning
[no%]division [Do not] Trap on division by zero.
[no%]inexact [Do not] Trap on inexact result.
[no%]invalid [Do not] Trap on invalid operation.
[no%]overflow [Do not] Trap on overflow.
[no%]underflow [Do not] Trap on underflow.
%all Trap on all the above.
%none Trap on none of the above.
common Trap on invalid, division by zero,
and overflow.
Note that the [no%] form of the option is used
only to modify the meanings of the %all or common
value and must be used with one of these values,
as shown in the example. The [no%] form of the
option by itself does not explicitly cause a par-
ticular trap to be disabled.
Defaults:
If you do not specify -ftrap, the compiler assumes
-ftrap=%none.
Example: -ftrap=%all,no%inexact means to set all
traps except inexact.
Warnings:
If you compile one routine with -ftrap, compile
all routines of the program with the same -ftrap
option; otherwise, you can get unexpected results.
Use the -ftrap=inexact trap with caution, as it
will result in the trap being issued whenever a
floating-point value cannot be represented
exactly. For example, the following statement may
generate this condition:
x = 1.0 / 3.0;
-G Build a dynamic shared library instead of an exe-
cutable file; see the ld(1) man page and the C++
User's Guide. All source files specified in the
command line are compiled with -xcode=pic13 by
default.
When building a shared library that uses tem-
plates, it is necessary in most cases to include
in the shared library those template functions
that are instantiated in the template database.
Using this option automatically adds those tem-
plates to the shared library as needed.
If you are creating a shared object by specifying
-G along with other compiler options that must be
specified at both compile time and link time, make
sure that those same options are also specified at
both compile time and link time when you link with
the resulting shared object.
When you create a shared object, all the object
files that are compiled with -xarch=v9 must also
be compiled with an explicit -xcode value as docu-
mented under the description of -xcode.
The following options are passed to ld if -c is
not specified:
o -dy
o -G
o -R
Do not use ld -G to build shared libraries; use CC
-G. The CC driver automatically passes several
options to ld that are needed for C++.
When you use the -G option, the compiler does not
pass any default -l options to ld. If you want the
shared library to have a dependency on another
shared library, you must pass the necessary -l
option on the command line. For example, if you
want the shared library to be dependent upon lib-
Crun, you must pass -lCrun on the command line.
-g Instructs both the compiler and the linker to
prepare the file or program for debugging. The
tasks include:
o Producing more detailed information, known as
stabs, in the symbol table of the object files
and the executable
o Producing some "helper functions," which the
Debugger can call to implement some of its
features
o Disabling the inline generation of functions;
that is, using this option implies the +d option
o Disabling certain levels of optimization
Interactions:
If you use this option with -xO[level] (or its
equivalent options, such as -O), you will get lim-
ited debugging information. For more information,
see the entry for -xO.
If you specify -gO and the optimization level is
-xO3 or lower, the compiler provides best-effort
symbolic information with almost full optimiza-
tion. Tail-call optimization and back-end inlining
are disabled.
If you use this option and the optimization level
is -xO4 or higher, the compiler provides best
effort symbolic information with full optimiza-
tion.
When you specify this option, the +d option is
specified automatically.
To use the full capabilities of the Performance
Analyzer, compile with the -g option. While some
performance analysis features do not require -g,
you must compile with -g to view annotated source,
some function level information, and compiler com-
mentary messages. See the analyzer(1) man page and
the Performance Analyzer manual for more informa-
tion.
The commentary messages that are generated with -g
describe the optimizations and transformations
that the compiler made while compiling your pro-
gram. Use the er_src(1) command to display the
messages which are interleaved with the source
code.
Warnings
If you compile and link your program in separate
steps, then including the -g option in one step
and excluding it from the other step will not
affect the correctness of the program, but it will
affect the ability to debug the program. Any
module that is not compiled with -g (or -g0), but
is linked with -g (or -g0) will not be prepared
properly for debugging. Note that compiling the
module that contains the function main with the -g
option (or the -g0 option) is usually necessary
for debugging.
See also:
For more information, see the explanations for
-g0, -xs, and +d, as well as the ld(1) man page.
-g0 Instructs the compiler to prepare the file or pro-
gram for debugging, but not to disable inlining.
This option is the same as -g, except that +d is
disabled and dbx cannot step into inlined func-
tions.
See also:
+d
-H On the standard error output (stderr), prints, one
per line, the path name of each #include file con-
tained in the current compilation.
-h[ ]lname
Assigns the name lname to the generated shared
dynamic library.
This is a loader option that is passed to ld. In
general, the name after -h should be exactly the
same as the one after -o. A space between the -h
and lname is optional.
The compile-time loader assigns the specified name
to the shared dynamic library you are creating.
It records the name in the library file as the
intrinsic name of the library. If there is no
-hlname option, then no intrinsic name is recorded
in the library file.
Every executable file has a list of needed shared
library files. When the runtime linker links the
library into an executable file, the linker copies
the intrinsic name from the library into that list
of needed shared library files. If there is no
intrinsic name of a shared library, then the
linker copies the path of the shared library file
instead. This command line is an example:
% CC -G -o libx.so.1 -h libx.so.1 a.o b.o c.o
Interactions:
This option accumulates instead of overrides.
-help Same as -xhelp=flags.
-Ipathname
Adds pathname to the list of directories that are
searched for #include files with relative file
names - those that do not begin with a slash.
The compiler searches for quote-included files (of
the form #include "foo.h") in this order:
1. In the directory containing the source
2. In the directories named with -I options, if
any
3. In the include directories for compiler-
provided C++ header files, ANSI C header
files, and special-purpose files
4. In /usr/include
The compiler searches for bracket-included files
(of the form #include <foo.h>) in this order:
1. In the directories named with -I options, if
any
2. In the include directories for compiler-
provided C++ header files, ANSI C header
files, and special-purpose files
3. In /usr/include
Note - If the spelling matches the name of a stan-
dard header file, also refer to "Standard Header
Implementation" in the C++ User's Guide.
Interactions:
This option accumulates instead of overrides.
The -I- option allows you to override the default
search rules.
If -library=no%Cstd is specified, then the
compiler-provided Cstd header files are not
searched.
Note - If -ptipath is not used, the compiler looks
for template files in -Ipathname. It is recom-
mended that you use -Ipathname instead of
-ptipath.
Warnings
Never specify the compiler installation area,
/usr/include, /lib, /usr/lib, as search direc-
tories.
-I- Change the include-file search rules to the fol-
lowing:
o For include files of the form #include
"foo.h", search the directories in the fol-
lowing order:
1. The directories named with -I options
(both before and after -I-)
2. The directories for compiler-provided
C++ header files, ANSI C header files,
and special-purpose files.
3. The /usr/include directory.
o For include files of the form #include
<foo.h>, search the directories in the fol-
lowing order:
1. The directories named with the -I
options that appear after -I-.
2. The directories for compiler-provided
C++ header files, ANSI C header files,
and special-purpose files.
3. The /usr/include directory.
Warnings
Never specify the compiler installation area,
/usr/include, /lib, /usr/lib, as search direc-
tories.
Only the first -I- in a command line causes the
described behavior.
-i Tells the linker, ld(1), to ignore any
LD_LIBRARY_PATH setting.
-inline Same as -xinline.
-instances=a
Controls the placement and linkage of template
instances. The following table shows the meanings
of the values of a.
Value Meaning
extern Places all needed instances into the
template repository within comdat sec-
tions and gives them global linkage. (If
an instance in the repository is out of
date, it is reinstantiated.)
Note: If you are compiling and linking
in separate steps and you specify
-instance=extern for the compilation
step, you must also specify it for the
link step.
explicit Places explicitly instantiated instances
into the current object file within com-
dat sections and gives them global link-
age. Does not generate any other needed
instances.
global Places all needed instances into the
current object file within comdat sec-
tions and gives them global linkage.
semiexplicit
Places explicitly instantiated instances
and all instances needed by the explicit
instances into the current object file
within comdat sections and gives them
global linkage.
static Note: -instances=static is deprecated.
There is no longer any reason to use
-instances=static, because
-instances=global now gives you all the
advantages of static without the disad-
vantages. This option was provided in
earlier compilers to overcome problems
that do not exist in this version of the
compiler.
Places all needed instances into the
current object file and gives them
static linkage.
Defaults:
If instances is not specified, -instances=global
is assumed.
Warnings:
static and semiexplicit values may produce invalid
results. See C++ User's Guide for more informa-
tion.
-instlib=file
Use this option to inhibit the generation of a
template instances that are duplicated in a
library, either static or shared, and the current
object. In general, if your program shares large
numbers of instances with libraries, try
-instlib=file and see whether compilation time
improves.
Values:
Use the file argument to specify the library that
you know contains the existing template instances.
The filename argument must contain a forward slash
'/' character. For paths relative to the current
directory, use dot-slash './'.
Defaults:
The -instlib=file option has no default and is
only used if you specify it. This option can be
specified multiple times and accumulates.
Example:
Assume that the libfoo.a and libbar.so libraries
instantiate many template instances that are
shared with your source file a.cc. Adding
-instlib=file and specifying the libraries helps
reduce compile time by avoiding the redundancy.
example% CC -c -instlib=./libfoo.a
-instlib=./libbar.so a.cc
Interactions:
When you compile with -g, if the library specified
with -instlib=file is not compiled with -g, those
template instances will not be debuggable. The
workaround is to avoid -instlib=file when you use
-g.
The -L path is not searched to find file.
Warning
If you specify a library with -instlib, you must
link with that library.
See Also:
-template, -instances, -pti
-KPIC (SPARC platform) Same as -xcode=pic32.
(x86 platform) Same as -Kpic.
-Kpic (SPARC platform) Same as -xcode=pic13.
(x86 platform) Produces position-independent code.
Use this option to compile source files when
building a shared library. Each reference to a
global datum is generated as a dereference of a
pointer in the global offset table. Each function
call is generated in pc-relative addressing mode
through a procedure linkage table.
-keeptmp Retains the temporary files that are created dur-
ing compilation. Along with -verbose=diags, this
option is useful for debugging.
-Lpath Adds path to the library search paths.
This option is passed to ld. The linker searches
the directory specified by path before it searches
the compiler-provided directories.
Interactions:
This option accumulates instead of overrides.
Warnings
Never specify the /usr/include, lib, /usr/lib, or
the compiler installation area as search direc-
tories.
-llib Add library liblib.a or liblib.so to linker's list
of search libraries.
This option is passed to ld. Normal libraries
have names such as liblib.a or liblib.so where the
lib and .a or .so parts are required. You can
specify the lib part with this option. Put as many
libraries as you want on a single command line;
they are searched in the order specified with
-Lpath.
Use this option after your object file names.
Interactions:
This option accumulates instead of overrides.
Warnings:
If you are building a multithreaded application or
linking your application to a multithreaded
library, you must compile and link your program
with the -mt option instead of linking your appli-
cation directly with -lthread.
See also:
-mt
-libmieee Use -xlibmieee.
-libmil Use -xlibmil.
-library=lib[,lib...]
Incorporates specified CC-provided libraries into
compilation and linking.
When the -library option is used to specify a CC-
provided library, the proper -I paths are set dur-
ing compilation and the proper -L, -Y, -P, and -R
paths and -l options are set during linking.
Values:
The following table shows the meanings of the
values for lib.
For compatibility mode (-compat[=4]):
Value Meaning
[no%]f77 Deprecated. Do not use. Use
-xlang=f77.
[no%]f90 Deprecated. Do not use. Use
-xlang=f90.
[no%]f95 Deprecated. Do not use. Use
-xlang=f95.
[no%]rwtools7 [Do not] Use classic-iostreams
Tools.h++ version 7.
[no%]rwtools7_dbg [Do not] Use debug-enabled
Tools.h++ version 7.
[no%]complex [Do not] Use libcomplex, for
complex arithmetic.
[no%]interval Deprecated. Do not use. Use
-xia.
[no%]libC [Do not] Use libC, the C++
support library.
[no%]gc [Do not] Use libgc, garbage
collection.
[no%]sunperf [Do not] Use the Sun Perfor-
mance Library(TM).
%none Use no C++ libraries except
for libC.
For standard mode (the default mode):
Value Meaning
[no%]f77 Deprecated. Do not use. Use
-xlang=f77.
[no%]f90 Deprecated. Do not use. Use
-xlang=f90.
[no%]f95 Deprecated. Do not use. Use
-xlang=f95.
[no%]rwtools7 [Do not] Use classic-iostreams
Tools.h++ version 7.
[no%]rwtools7_dbg [Do not] Use debug-enabled
Tools.h++ version 7.
[no%]rwtools7_std [Do not] Use standard-
iostreams Tools.h++ version 7.
[no%]rwtools7_std_dbg
[Do not] Use debug_enabled
standard-iostreams Tools.h++
version 7.
[no%]interval Deprecated. Do not use. Use
-xia.
[no%]iostream [Do not] Use libiostream, the
classic iostreams library.
[no%]Cstd [Do not] Use libCstd, the C++
standard library. [Do not]
include the compiler-provided
C++ standard library header
files.
[no%]stlport4 [Do not] Use STLport's imple-
mentation of the standard
library. If you specify
-library=stlport4, the command
expands to
-library=no%Cstd,stlport4.
[no%]stlport4_dbg [Do not] Use STLport's debug-
enabled library.
[no%]Crun [Do not] Use libCrun, the C++
runtime library
[no%]gc [Do not] Use libgc, garbage
collection.
[ no% ]sunperf [Do not] Use the Sun Perfor-
mance Library (TM).
%none Use no C++ libraries except
for libCrun.
Defaults:
For compatibility mode (-compat[=4]), if -library
is not specified, -library=libC is assumed.
The libC library is always included unless it is
specifically excluded using -library=no%libC.
For standard mode (the default mode), the libCstd
library is always included unless it is specifi-
cally excluded by using -library=%none,
-library=no%Cstd, or -library=stlport4.
Also, regardless of standard or compat mode, the
libm and libc libraries are always included, even
if you specify -library=%none. In standard mode,
libCrun is always included.
Examples:
To link in standard mode (the default mode)
without any C++ libraries (except libCrun), use:
example% CC -library=%none
To include the classic-iostreams Rogue Wave
tools.h++ library in standard mode, use:
example% CC -library=rwtools7,iostream
To include the standard-iostreams Rogue Wave
tools.h++ library in standard mode, use:
example% CC -library=rwtools7_std
To include the classic-iostreams Rogue Wave
tools.h++ library in compatibility mode, use:
example% CC -compat -library=rwtools7
When you include the classic-iostreams Rogue Wave
tools library in standard mode (the default mode),
you must also include libiostream (see the C++
Migration Guide for additional information). You
can use the standard-iostreams Rogue Wave tools
library in standard mode only. The following com-
mand examples show both valid and invalid use of
the Rogue Wave tools.h++ library options.
Valid:
example% CC -compat -library=rwtools7 foo.cc
Invalid:
example% CC -compat -library=rwtools7_std foo.cc
Valid, classic iostreams
example% CC -library=rwtools7,iostream foo.cc
Invalid
example% CC -library=rwtools7 foo.cc
Valid, standard iostreams
example% CC -library=rwtools7_std foo.cc
Invalid
example% CC -library=rwtools7_std,iostream foo.cc
If you include both libCstd and libiostream, you
must be careful to not use the old and new forms
of iostreams (for example, cout and std::cout)
within a program to access the same file. Mixing
standard iostreams and classic iostreams in the
same program is likely to cause problems if the
same file is accessed from both classic and stan-
dard iostream code.
Programs linking neither libC nor libCrun might
not use all features of the C++ language.
If -xnolib is specified, -library is ignored.
Interactions:
If a library is specified with -library, the
proper -I paths are set during compilation. The
proper -L, -Y, -P, -R, paths and -l options are
set during linking.
This option accumulates instead of overrides.
Only one rwtool library can be used at a time and
you cannot use any rwtool library with
-library=stlport4.
You cannot use -library=stlport4 and -library=Cstd
on the same command line.
You cannot use -library=sunperf and
-xlic_lib=sunperf on the same command line.
Use of the -library option ensures that the -l
options for the specified libraries are emitted in
the right order. For example, the -l options are
passed to ld in the order -lrwtool -liostream for
both -library=rwtools7,iostream and
-library=iostream,rwtools7.
When you use the interval arithmetic libraries,
you must include one of the following libraries:
libC, libCstd, or libiostreams.
The specified libraries are linked before the sys-
tem support libraries are linked.
Warnings:
Do not redefine or modify any of the configuration
macros for STLport, Rogue Wave or Sun Microsystems
C++ libraries. The libraries are configured and
built in a way that works with the C++ compiler.
libCstd and Tool.h++ are configured to inter-
operate so modifying the configuration macros
results in programs that will not compile, will
not link, or do not run properly.
If you compile and link in separate steps, the set
of -library options that appear in the compile
command must appear in the link command.
The set of libraries is not stable and might
change from release to release.
The stlport4, Cstd and iostream libraries provide
their own implementation of I/O streams. Specify-
ing more than one of these with the -library
option can result in undefined program behavior.
See also:
-I,-l,-R, -staticlib, -xia, -xlang, -xnolib,
C++ Migration Guide,
C++ Interval Arithmetic Programming Reference,
Tools.h++ User's Guide,
Tools.h++ Class Library Reference,
C++ Standard Reference Library
-mc Removes duplicate strings from the .comment sec-
tion of the object file. If the string contains
blanks, the string must be enclosed in quotation
marks. When you use the -mc option, the mcs -c
command is invoked.
-migration
Explains where to get information about migrating
source code that was built for earlier versions of
the compiler.
Note - This option might cease to exist in the
next release.
-misalign (SPARC platform) Permits misaligned data, which
would otherwise generate an error, in memory.
This option informs the compiler that some data in
your program is not properly aligned. Thus, very
conservative loads and stores must be used for any
data that might be misaligned, that is, one byte
at a time. Using this option may cause significant
degradation in runtime performance. The amount of
degradation is application dependent.
If you compile and link in separate steps and are
using the -misalign option, you must include the
option in both steps.
If possible, do not link aligned and misaligned
parts of the program.
Interactions:
o When using #pragma pack on a SPARC platform to
pack denser than the type's default alignment,
the -misalign option must be specified for both
the compilation and the linking of the applica-
tion.
o Misaligned data is handled by a trap mechanism
that is provided by ld(1) at run-time. If an
optimization flag (-xO{1|2|3|4|5} or an
equivalent flag) is used with the -misalign
option, the additional instructions required for
alignment of misaligned data are inserted into
the resulting object file and will not generate
runtime misalignment traps.
-mr[,string]
Removes all strings from the .comment section of
the object file and, if string is supplied, places
string in that section. If the string contains
blanks, the string must be enclosed in quotation
marks. When you use this option, the command mcs
-d [-a string] is invoked.
Interactions:
This option is not valid when either -S, -xsbfast,
or -sbfast is specified.
-mt Compile and link for multithreaded code.
This option:
o Passes -D_REENTRANT to the preprocessor
o Passes -lthread in the correct order to ld
o Ensures that, for standard mode (the default
mode), libthread is linked before libCrun
o Ensures that, for compatibility mode (-compat),
libthread is linked before libC
The -mt option is required if the application or
libraries are multithreaded.
Warnings:
To ensure proper library linking order, you must
use this option, rather than -lthread, to link
with libthread.
If you are using POSIX threads, you must link with
the options -mt -lpthread. The -mt option is
necessary because libC (compatibility mode) and
libCrun (standard mode) need libthread for a mul-
tithreaded application.
If you compile and link in separate steps and you
compile with -mt, you might get unexpected
results. If you compile one translation unit with
-mt, compile all units of the program with -mt.
If you are mixing parallel Fortran objects with
C++ objects, the link line must specify the -mt
flag.
C99 support is not available in compat mode (-com-
pat=4).
See also:
-xnolib
-native Use -xtarget=native.
-noex Use -features=no%except.
-nofstore (x86 platform) Disables forced precision of
expression.
This option does not force the value of a
floating-point expression or function to the type
on the left side of an assignment but leaves the
value in a register when that expression or func-
tion is assigned to a variable or when it is cast
to a shorter floating-point type.
See also:
-fstore
-nolib Use -xnolib.
-nolibmil Use -xnolibmil.
-noqueue Disables license queueing. If no license is
available, this option returns without queueing
your request and without compiling. A nonzero
status is returned for testing makefiles.
-norunpath
Does not build the path for shared libraries into
the executable.
If an executable file uses shared libraries, then
the compiler normally builds in a path that points
the runtime linker to those shared libraries. To
do so, the compiler passes the -R option to ld.
The path depends on the directory where you have
installed the compiler.
This option is recommended for building execut-
ables that will be shipped to customers who may
have a different path for the shared libraries
that are used by the program.
Interactions:
If you use any shared libraries under the compiler
installed area (default location
/opt/SUNWspro/lib) and you also use -norunpath,
then you should either use the -R option at link
time or set the environment variable
LD_LIBRARY_PATH at run time to specify the loca-
tion of the shared libraries. This will allow the
runtime linker to find the shared libraries.
-O The -O macro now expands to -xO3 instead of -xO2.
The change in default yields higher run-time per-
formance. However, -xO3 may be inappropriate for
programs that rely on all variables being automat-
ically considered volatile. Typical programs that
might have this assumption are device drivers and
older multi-threaded applications that implement
their own synchronization primitives. The work
around is to compile with -xO2 instead of -O.
-O[level] Use -xOlevel.
-o filename
Sets the name of the output file (with the suffix,
.o) or the executable file to filename.
Note - If the compiler must store template
instances, it stores them in the template reposi-
tory in the output file's directory.
Warning:
filename must have the appropriate suffix for the
type of file to be produced by the compilation
(see FILES). It cannot be the same file as the
source file, since the CC driver does not
overwrite the source file.
+p Ignore non-standard preprocessor asserts.
Defaults:
If +p is not present, the compiler asserts.
Interactions:
If +p is used, the sun, unix, sparc, and i386 mac-
ros are not defined.
-P Only preprocesses source: does not compile. (Out-
puts a file with a .i suffix.)
This option does not include preprocessor-type
line number information in the output.
-p Obsolete See -xpg.
-pentium (x86 platform) Use -xtarget=pentium.
-pg Use -xpg.
-PIC SPARC: Same as -xcode=pic32.
x86: Same as -KPIC.
-pic SPARC: Same as -xcode=pic13.
x86: Same as -Kpic.
-pta Use -template=wholeclass.
-ptipath Specifies an additional search directory for tem-
plate source.
This option is an alternative to the normal search
path set by -Ipathname. If the -ptipath flag is
used, the compiler looks for template definition
files on this path and ignores the -Ipathname
flag.
Using the -Ipathname flag instead of -ptipath pro-
duces less confusion.
Interactions:
This option accumulates instead of overrides.
-pto Use -instances=static.
-ptrpath This option is obsolete and is ignored by the com-
piler.
Warnings:
Even though the -ptr option is ignored, you should
remove it from all compilation commands because,
in a later release, it may be reused with a dif-
ferent behavior.
-ptv Use -verbose=template.
-Qoptionphase[,option...]
Passes option to the compilation phase.
To pass multiple options, specify them in order as
a comma-separated list. Options that are passed to
components with -Q can be reordered. Options that
the driver recognizes are kept in the correct
order. Do not use -Q for options that the driver
already recognizes. For example, the C++ compiler
recognizes the -z option for the linker (ld). If
you issue a command like this
CC -G -zallextract mylib.a -zdefaultextract ... //
correct
the -z options are passed in order to the linker.
But if you specify the command like this
CC -G -Qoption ld -zallextract mylib.a -Qoption ld
-zdefaultextract ... // error
the -z options can be reordered, giving incorrect
results.
The following table shows the possible values for
phase.
SPARC x86
ccfe ccfe
iropt cg386
cg codegen
CClink CClink
ld ld
Examples:
When the CC driver invokes ld in the following
command, -Qoption passes the -i option to ld:
example% CC -Qoption ld -i test.cc
Warnings:
Be careful to avoid unintended effects. For exam-
ple
-Qoption ccfe -features=bool,iddollar
is interpreted as
-Qoption ccfe -features=bool -Qoption ccfe iddol-
lar
The correct usage is
-Qoption ccfe -features=bool,-features=iddollar
-qoption phase option
Use -Qoption.
-qp Same as -p.
-Qproduce sourcetype
Causes the CC driver to produce source code of the
type sourcetype. Source code types are shown in
the following table.
Value Meaning
.i Preprocessed C++ source from ccfe
.o Object file from the code generator
.s Assembler source from the code gen-
erator
-qproduce sourcetype
Use -Qproduce.
-Rpath[:path...]
Builds dynamic library search paths into the exe-
cutable file.
This option is passed to ld.
Defaults:
If the -R option is not present, the library
search path that is recorded in the output object
and passed to the runtime linker depends upon the
target architecture instruction specified by the
-xarch option (when -xarch is not present) are
concatenated, with each -xarch-generic is
assumed).
For -xarch=v9, -xarch=v9a, or -xarch=v9b:
<install-directory>/SUNWspro/lib/v9
For any other -xarch value:
<install-directory>/SUNWspro/lib
In a default installation, <install-directory> is
/opt.
Interactions:
This option accumulates instead of overrides.
If both the LD_RUN_PATH environment variable and
the -R option are specified, then the path from -R
is scanned, and the path from LD_RUN_PATH is
ignored.
See also:
-norunpath
-readme Same as -xhelp=readme.
-S Compiles and generates only assembly code. This
option causes the CC driver to compile the program
and output an assembly source file, but not assem-
ble the program. The assembly source file is
named with a .s suffix.
-s Strip the symbol table from the executable file.
This option removes all symbol information from
output executable files. This option is passed to
ld.
-sb Deprecated - do not use. The source browser func-
tionality is obsolete.
-sbfast Deprecated - do not use. The source browser func-
tionality is obsolete.
-staticlib=l[,l...]
Indicates which C++ libraries specified by the
-library option (including its defaults), by the
-xlang option, and by the -xia option are to be
linked statically.
Values:
l must be one of the following values.
Value Meaning
[no%]library [Do not] link library statically.
The valid values for library are
all valid values for -library
(except %all and %none ) all the
valid values for -xlang, and inter-
val (to be used in conjunction with
-xia).
%all Link statically all the libraries
specified by the -library option,
all the library specified in the
-xlang option, and, if -xia is
specified, the interval libraries.
%none Link no libraries specified in the
-library option and the -xlang
option statically. If -xia is
specified in the command line, link
no interval libraries statically.
Defaults:
If -staticlib is not specified, -staticlib=%none
is assumed.
Interactions:
This option accumulates instead of overrides.
The -staticlib option only works for the C++
libraries that are selected explicitly with the
-xia, the -xlang option, and the -library option,
in addition to the C++ libraries that are selected
implicitly by default. In compatibility mode
(-compat=[4]), libC is selected by default. In
standard mode (the default mode), Cstd and Crun
are selected by default.
Examples:
The following command links libCrun statically
because Crun is a default value for -library.
(correct)
example% CC -staticlib=Crun test.cc
However, the following command does not link libgc
because libgc is not linked unless explicitly
specified with the -library option.
(incorrect)
example% CC -staticlib=gc test.cc
With the following command, the librwtool library
is linked dynamically. Because librwtool is not a
default library and is not selected using the
-library option, -staticlib has no effect.
(incorrect)
example% CC -lrwtool -library=iostream \
-staticlib=rwtools7
This command links the Tools.h++ library stati-
cally.
(correct)
example% CC -library=rwtools7,iostream \
-staticlib=rwtools7
Warnings:
The set of allowable values for libraries is not
stable and might change from release to release.
When using -xarch=v9, -xarch=v9a, or -xarch=v9b,
(or equivalent 64-bit architecture options), some
libraries are not available as static libraries.
The options -staticlib=Crun and -staticlib=Cstd do
not work on 64-bit Solaris x86 platforms. Sun
recommends against linking these libraries stati-
cally on any platform. In some cases, static link-
ing can prevent a program from working.
-sync_stdio=[yes|no]
Use this option when your run-time performance is
degraded due to the synchronization between C++
iostreams and C stdio. Synchronization is needed
only when you use iostreams to write to cout and
stdio to write to stdout in the same program. The
C++ standard requires synchronization so the C++
compiler turns it on by default. However, applica-
tion performance is often much better without syn-
chronization. If your program does not write to
both cout and stdout, you can use the option
-sync_stdio=no to turn off synchronization.
Defaults:
If you do not specify -sync_stdio, the compiler
sets it to -sync_stdio=yes.
Examples:
Consider the following example:
#include <stdio.h>
#include <iostream>
int main()
{
std::cout << "\nHello ";
printf("beautiful ");
std::cout << "world!";
printf("\n");
}
With synchronization, the program prints on a line
by itself
Hello beautiful world!
Without synchronization, the output gets scram-
bled.
Warnings:
This option is only effective for linking of exe-
cutables, not for libraries.
-temp=path
Defines the directory for temporary files.
This option sets path as the directory for the
temporary files generated during the compilation
process.
See also:
-keeptmp
-template=a[,a...]
Enables/disables various template options.
a must be one of the following values.
Value Meaning
[no%]extdef [Do not] search for template
definitions in separate source
files.
[no%]geninlinefuncs [Do not] instantiate inline
member functions of the expli-
citly instantiated class tem-
plate which were not generated
previously.
[no%]wholeclass [Do not] Instantiate a whole
template class, rather than
only those functions that are
used. You must reference at
least one member of the class;
otherwise, the compiler does
not instantiate any members
for the class.
Defaults:
-template=no%wholeclass,extdef,no%geninlinefuncs
-time Use -xtime.
-Uname Deletes initial definition of the preprocessor
symbol name. This option removes any initial
definition of the macro symbol name that was
created by -D on the same command line, including
those implicitly placed there by the command-line
driver.
This option has no effect on any other predefined
macros nor on macro definitions in source files.
To see the -D options that are placed on the com-
mand line by the command-line driver, add the
-dryrun option to your command line.
You can specify multiple -U options on the command
line.
Examples:
The following command undefines the predefined
symbol __sun. Preprocessor statements in test.cc
such as #ifdef(__sun) will sense that the symbol
is undefined.
example% CC -U__sun test.cc
Interactions:
This option accumulates instead of overrides.
All -U options are processed after any -D options
that are present.
-unroll=n Same as -xunroll=n.
-V Same as -verbose=version.
-v Same as -verbose=diags.
-vdelx Deprecated, do not use. This flag is available
only for compatibility mode (-compat[=4]).
For expressions using delete[], this option gen-
erates a call to the runtime library function
_vector_deletex_ instead of generating a call to
_vector_delete_.
The function _vector_delete_ takes two arguments:
the pointer to be deleted and the size of each
array element.
The function _vector_deletex_ behaves the same as
_vector_delete_ except that it takes an addi-
tional third argument: the address of the des-
tructor for the class. This third argument is not
used by the function but is provided to be used by
third-party vendors.
Defaults:
When -vdelx is not specified, the compiler gen-
erates a call to _vector_delete_ for expressions
using delete[].
Warnings:
This is an obsolete option that will be removed in
future releases. Do not use this option unless you
have bought some software from a third-party ven-
dor and the vendor recommends using this option.
-verbose=a[,a...]
Controls compiler verbosity.
a must be one of the following values.
Value Meaning
[no%]template [Do not] Turn on the template
instantiation verbose mode,
sometimes called the verify
mode. The verbose mode
displays each phase of instan-
tiation as it occurs during
compilation.
[no%]diags [Do not] Print the command
line for each compilation
pass.
[no%]version [Do not) Direct the CC driver
to print the names and version
numbers of the programs it
invokes.
%all Invokes all the above.
%none Invokes none of the above.
Defaults:
If -verbose is not specified, the compiler assumes
-verbose=%none.
Interactions:
This option accumulates instead of overrides.
+w Identifies code that might have unintended conse-
quences. The +w option no longer generates a warn-
ing if a function is too large to inline or if a
declared program element is unused. These warnings
do not identify real problems in the source, and
were thus inappropriate to some development
environments. Removing these warnings from +w
enables more aggressive use of +w in those
environments. These warnings are still available
with the +w2 option.
Generates additional warnings about questionable
constructs that are:
o Nonportable
o Likely to be mistakes
o Inefficient
Defaults:
If +w is not specified, the compiler warns about
constructs that are almost certainly problems.
Interactions:
Some C++ standard headers result in warnings when
compiled with +w.
+w2 Emits the same warnings as +w as well as warnings
about technical violations that are probably harm-
less, but that might reduce the maximum portabil-
ity of your program.
The +w2 option no longer warns about the use of
implementation-dependent constructs in the system
header files. Because the system header files are
the implementation, the warning was inappropriate.
Removing these warnings from +w2 enables more
aggressive use of the option.
Warnings:
Some Solaris software and C++ standard header
files result in warnings when compiled with +w2.
-w Suppresses warning messages.
This option causes the compiler not to print warn-
ing messages. Some warnings, particularly warn-
ings regarding serious anachronisms, cannot be
suppressed.
-Xm Use -features=iddollar.
-xa Generates code for profiling.
If set at compiler time, the TCOVDIR environment
variable specifies the directory where the cover-
age (.d) files are located. If TCOVDIR is not set,
then the coverage (.d) files remain in the same
directory as the source files.
Use this option only for backward compatibility
with old coverage files. See -xprofile=tcov for
information on the new style of profiling, and the
tcov (1) man page, and Profiling Tools for more
details.
Interactions:
The -xprofile=tcov and the -a options are compati-
ble in a single executable. That is, you can link
a program that contains some files that have been
compiled with -xprofile=tcov, and others that have
been compiled with -xa. You cannot compile a sin-
gle file with both options.
-xa is incompatible with -g.
Warnings:
If you compile and link in separate steps, and you
compile with -xa, then be sure to link with -xa,
or you might get unexpected results.
-xalias_level[= n]
Allows the compiler to perform type-based alias-
analysis.
Defaults:
n must be any, simple, or compatible.
o -xalias_level
If you do not specify -xalias_level, the com-
piler sets it to -xalias_level=any. If you
specify -xalias_level without any values, the
compiler sets it to -xalias_level=compatible.
o -xalias_level=any
At this level of analysis, the compiler assumes
that any type may alias any other type. However,
despite this assumption, some optimization is
possible.
o -xalias_level=simple
The compiler assumes that fundamental types are
not aliased. Specifically, a storage object with
a dynamic type that is one of the following fun-
damental types:
* char, signed char, and unsigned char,
* wchar_t
* short int, unsigned short int,
* int, unsigned int,
* long int, unsigned long int,
* long long int, unsigned long long int,
* float, double, long double,
* enumeration types,
* data pointer types,
* function pointer types,
* data member pointer types, or
* function member pointer types
will only be accessed through lvalues of the
following types:
* the dynamic type of the object,
* a constant or volatile qualified version
of the dynamic type of the object,
* a type that is the signed or unsigned type
corresponding to the dynamic type of the
object,
* a type that is the signed or unsigned type
corresponding to a constant or volatile
qualified version of the dynamic type of
the object,
* an aggregate or union type that includes
one of the aforementioned types among its
members (including, recursively, a member of
a subaggregate or contained union), or
* a char or unsigned char type.
o -xalias_level=compatible
The compiler assumes that layout-incompatible
types are not aliased. A storage object is only
accessed through lvalues of the following types:
* the dynamic type of the object,
* a constant or volatile qualified version of
the dynamic type of the object,
* a type that is the signed or unsigned type
which corresponds to the dynamic type of
the object,
* a type that is the signed or unsigned type
which corresponds to the constant or volatile
qualified version of the dynamic type of
the object,
* an aggregate or union type that includes one
of the aforementioned types among its members
(including, recursively, a member of a
subaggregate or contained union),
* a type that is (possibly constant or volatile
qualified) base class type of the dynamic
type of the object, or
* a char or unsigned char type.
The compiler assumes that the types of all
references are layout compatible with the
dynamic type of the corresponding storage
object. Two types are layout-compatible under
the following conditions:
* If two types are the same type, then they are
layout-compatible types.
* If two types differ only in constant or
volatile qualification, then they are
layout-compatible types.
* For each of the signed integer types, there
exists a corresponding (but different)
unsigned integer type. These corresponding
types are layout compatible.
* Two enumeration types are layout-compatible if
they have the same underlying type.
* Two Plain Old Data (POD) struct types are
layout compatible if they have the same number
of members, and corresponding members
(in order) have layout compatible types.
* Two POD union types are layout compatible
if they have the same number of members, and
corresponding members (in any order) have
layout compatible types.
References may be non-layout-compatible with the
dynamic type of the storage object under limited
circumstances:
* If a POD union contains two or more POD
structs that share a common initial sequence,
and if the POD union object currently contains
one of those POD structs, it is permitted to
inspect the common initial part of any of
them. Two POD structs share a common initial
sequence if corresponding members have layout
compatible types and, as applicable to bit
fields, the same widths, for a sequence of
one or more initial members.
* A pointer to a POD struct object, suitably
converted using a reinterpret_cast, points
to its initial member, or if that member is
a bit field, to the unit in which it resides.
Interactions:
The compiler does not perform type-based alias
analysis at optimization level -xO2 and below.
-xar Creates archive libraries.
When building a C++ archive that uses templates,
it is necessary in most cases to include in the
archive those template functions that are instan-
tiated in the template repository. Using this
option automatically adds those templates to the
archive as needed.
Values:
Specify -xar to invokes ar -c-r and create an
archive from scratch.
Examples:
The following command archives the template func-
tions contained in the repository and the object
files.
example% CC -xar -o libmain.a a.o b.o c.o
Warnings:
Do not add .o files from the template repository
on the command line.
Do not use the ar command directly for building
archives. Use CC -xar to ensure that template
instantiations are automatically included in the
archive.
See Also:
ar(1)
-xarch=isa
Specifies the target architecture instruction set
(ISA).
This option limits the code generated by the com-
piler to the instructions of the specified
instruction set architecture. This option does not
guarantee use of any target-specific instructions.
However, use of this option may affect the porta-
bility of a binary program. See the Notes and
Warnings sections.
If you compile and link in separate steps, make
sure you specify the same value for -xarch in both
steps.
Values:
For SPARC platforms:
Value Meaning
generic Produce 32-bit object binaries for good
performance on most systems.
This is no longer the default. The new
default is -xarch=v8plus. This option
uses the best instruction set for good
performance on most processors without
major performance degradation on any of
them. With each new release, the defini-
tion of "best" instruction set may be
adjusted, if appropriate. Use the
-xdryrun option to see the
-xarch=generic value for this release.
generic64 Product 64-bit object binaries for good