CC -- C++ translator (``cfront'')


CC [ options ] file ...


CC is the C++ compiler. The command uses an internal ANSI C preprocessor for preprocessing, cfront for syntax and type checking, and cc(CP) for code generation and linking.

CC takes arguments ending in ``.C'' or ``.i'' to be C++ source files. ``.i'' files are presumed to be the output of cpp. Both ``.c'' and ``.o'' files are also accepted by the CC command and passed to cc(CP).

In addition to the options described below, CC accepts other options and passes them on to the C compilation system tools. See cc(CP) for C compiler options, ld(CP) for link editor options, and as(CP) for assembler options.

The following options apply to the C++-specific parts of the compilation process:

-ec xxx
Escape option to pass options to the C compiler. For example:

CC -ec xxx -ec yyy ...

will pass ``xxx yyy'' to the C compiler.

-el xxx
Escape option to pass options to the linker.

Unmangle struct member and local variable names except where ambiguous.

Dump out structs in C output even if not used. This feature is no longer automatically enabled by -g. -gdump imposes a performance penalty.

Decrease inline cutoff (less inlining will be done). This will in general decrease program speed but make the program smaller. Inlining of very small inline functions will continue to be done.

Increase inline cutoff (more inlining will be done). This will in general increase program speed at the expense of increased space.

Run only cpp. on the C++ source files and send the result to standard output.

Run only cpp. and cfront on the C++ source files, and send the result to standard output. The output contains #line directives.

When used in combination with -E or -F, place the output from each input file in a file with the specified suffix in the current directory.

-g, -dbx, -dbxC
Generate additional information for the use of dbXtra (sdb may be used with some difficulty) for source-level debugging. Some code optimizations are not performed. The use of -dbx instead of -g causes an extra file to be produced allowing enhanced C++ debugging; this file passes information about classes and other C++ constructs to dbXtra. The -dbxC option allows enhanced debugging and examination of both the C++ and generated C source using dbXtra. Use of these options also passes -g to the C compiler. The -dbx and -dbxC options do not disable inlining. If you wish to debug inlined functions, you must explicitly turn inlining off using the +d option.

The C++ compiler can generate either ANSI C-conforming or K&R C-style declarations. The +a option specifies which style of declarations to produce. The default, +a0, causes the compiler to produce K&R C-style declarations. The +a1 option causes the compiler to produce ANSI C-conforming declarations.

Do not inline-expand functions declared inline.

Only to be used on classes for which virtual functions are present, and all the virtual functions are defined either as inline or pure. In this circumstance, this option optimizes a program to use less space by ensuring that only one virtual table per class is generated. +e1 causes virtual tables to be external and defined. +e0 causes virtual tables to be external but only declared. This option is ignored for any class that contains an out-of-line virtual function.

Leave the intermediate ``..c'' files in the current directory during the compilation process. These files do not contain any preprocessing directives, although the files passed to the C compiler do. When templates are used, it causes the instantiation system to leave ``..c'' files in the repository.

Disallow all anachronistic constructs. Ordinarily the translator warns about anachronistic constructs; under +p (for ``pure''), the translator will not compile code containing anachronistic constructs. See the C++ Product Reference Manual for a list of anachronisms.

Warn about constructs that are likely to be mistakes, be nonportable, or be inefficient. Without the +w option, the compiler issues warnings only about constructs that are almost certainly errors.

Read a file of size and alignments created by compiling and executing szal.c. The form of the created file is identical to the entries in size.h. This option is useful for cross compilations and for porting the translator. See the Development System Release and Installation Notes for more information.

Informs the C++ compiler that files ending with the specified suffix are C++ files.

The template instantiation system adds several options to CC. These are specified on the CC line or by setting the environment variable PTOPTS. For example, to permanently enable verbose mode, you would say:

export PTOPTS=-ptv (for Bourne shell)
setenv PTOPTS -ptv (for C shell)

Instantiate a whole template class rather than only those members that are needed.

Dump list of instantiation objects to a file if any were recompiled or the file does not exist. Also bypasses actual link step. Can be used with -pti in makefiles of the form:
appl:	appl.o ilist
	CC -pti -o appl `cat ilist` appl.o

appl.o:	appl.c Vector.h A.h C.h
	CC -c appl.c

ilist:	always
	CC -ptdilist appl.o


Force repository names to be less than 14 characters even if the OS supports long names. This is useful in building archive libraries.

Ignore ptlink pass.

Force ptlink to continue trying to instantiate even after instantiation errors on previous template classes.

Have ptlink dump out a ``link map'' showing what actions the link simulator took.

Change the default instantiation behavior for one-file programs to that of larger programs, where instantiation is broken out separately and the repository updated. One-file programs normally have instantiation optimized so that instantiation is done into the application object itself.

Specify a repository, with ./ptrepository the default. If several repositories are given, only the first is writeable, and the default repository is ignored unless explicitly named.

Split instantiations into separate object files, with one function per object (including overloaded functions), and all class static data and virtual functions grouped into a single object.

Turn on verbose or verify mode, which displays each phase of instantiation as it occurs, together with the elapsed time in seconds that phase took to complete. Use of this option is recommended if you are new to templates. With verbose mode, the reason why an instantiation is done and the exact CC command used are displayed.

In release 3.1, -pts and -pta cannot be used together, that is, -pts can be used only to split up needed functions rather than all functions.

The preprocessor directives -I and -D work as they normally do, but must also be specified at link time, to pick up the various template and application type header files.


The diagnostics produced by CC itself are intended to be self-explanatory. Occasional messages may be produced by the C compiler or link editor.


The following are some of the user-settable environment variables:

C compiler (default: cc)

cfront (default: CCROOTDIR/cfront)

ANSI C preprocessor (default: CCROOTDIR/cpp)


C++ source file

optional cfront output

C++ source after preprocessing

assembly language file

object file

dbXtra debug information

linked output

C compiler

standard C library

C++ driver shell script

ANSI C preprocessor

C++-to-C translator

CCROOTDIR/patch or munch
post-link editor

name demangler for diagnostic messages

CCROOTDIR/ptcomp and ptlink
enable template instantiation

dbXtra debug processor

C++ standard library

C++ coroutine library

C++ complex arithmetic library

colon-separated list of standard directories for #include files

The usual locations for the standard directories are as follows:




See also

cc(CP), ld(CP)

Stan Lippman. C++ Primer, Second Edition Addison-Wesley 1991.

B. W. Kernighan and D. M. Ritchie. The C Programming Language, Prentice-Hall 1988.

Bjarne Stroustrup. The C++ Programming Language, Second Edition Addison-Wesley, 1991.

Standards conformance

CC is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.

© 2003 Commands for Programming (CP)
SCO OpenServer Release 5.0.7 -- 11 February 2003