CC(1) — USER COMMANDS
NAME
CC − C++ translator
SYNOPSIS
CC [-E] [-F|-Fc] [−.suffix] [+i] [+L] [+x file] [+e0|+e1] [+d] [+w] [+p] [+a0|+a1] file ...
DESCRIPTION
CC (capital CC) translates C++ source code to C source code. The command uses cpp(1) for preprocessing, cfront for syntax and type checking, and cc(1) for code generation.
For each C++ source file, CC creates a temporary file in a temporary directory under the current directory, file.c, containing the generated C file for compilation with cc. The +i or −.suffix options will save a copy of this file in the current directory, with the name file..c or file.suffix.
CC takes arguments ending in .c, .C, .cc, .cxx or .i to be C++ source programs. .i files are presumed to be the output of cpp(1). Both .s and .o files are also accepted by the CC command and passed to cc(1).
CC interprets the following options:
−E Run only cpp on the C++ source files and send the result to standard output.
−F Run only cpp and cfront on the C++ source files, and send the result to standard output.
−Fc Like the −F option, but the output is C source code suitable as a .c file for cc(1).
−g Produce additional symbol table information for dbx(1) and dbxtool(1) and pass the −g option to cc(1) and the −lg flag to ld(1).
−.suffix Instead of using standard output for the −E , −F or −Fc options, place the output from each .c file on a file with the corresponding .suffix.
+i Produce intermediate ..c C language file in the current directory.
+L Generate source line number information using the format "#line %d" instead of "# %d".
+xfile Read a file of sizes and alignments. Each line contains three fields: a type name, the size (in bytes), and the alignment (in bytes). This option is useful for cross compilations.
+e[01] Optimize a program to use less space by ensuring that only one virtual table is generated per class. +e1 causes virtual tables to be external and defined, that is, initialized. +e0 causes virtual tables to be external but only declared, that is, uninitialized. When neither option is used, virtual tables will be static, that is, there will be one per file. Usually, +e1 is used to compile one file that includes class definitions, while +e0 is used on all the other files including those class definitions.
+d Do not expand inline functions.
+w Warn about all questionable constructs. Without the +w option, the translator issues warnings only about constructs that are almost certainly problems.
+p Disallow all anachronistic constructs. Ordinarily the translator warns about anachronistic constructs; under +p (for “pure”), the translator will not compile code containing anachronistic constructs, such as “assignment to this.” See the AT&T C++ Language System Product Reference Manual for a list of anachronisms.
+a[01] The translator can generate either ANSI C style or “Classic C” (also known as K&R C) style declarations. The +a option specifies which style of declarations to produce. +a0, the default, causes the translator to produce “Classic C” style declarations. The +a1 option causes the translator to produce ANSI C style declarations.
See ld(1) for loader options, as(1) for assembler options, cc(1) for code generation options, and cpp(1) for preprocessor options.
FILES
Most of the default pathnames listed below can be modified by changing environmental variables in CC.
file.[Cc] input file
file.cc
file.cxx
file..c optional cfront output
file.o object file
file.cxx
a.out linked output
/lib/cpp C preprocessor
cfront C front end
/bin/cc C compiler
/lib/libc.a standard C library
/usr/CC/‘arch‘/libC.a standard C++ library
/usr/CC/‘arch‘/libtask.a C++ real-time library
/usr/CC/‘arch‘/libcomplex.a C++ complex library
/usr/CC/incl standard directory for #include files
SEE ALSO
cc(1), prof(1), ld(1), cpp(1), as(1), monitor(3).
Bjarne Stroustrup, The C++ Programming Language, Addison-Wesley 1986.
B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall 1978.
AT&T C++ Language System Release 2.0, Product Reference Manual
DIAGNOSTICS
The diagnostics produced by CC itself are intended to be self-explanatory. Occasional messages may be produced by the assembler or loader. No messages should be produced by cc(1).
BUGS
Some “used before set” warnings are wrong.
NOTES
You can use shell variables to tell the C++ translator script CC that various passes are located in unusual places or have unusual names. For example, if you have your own version of the C compiler called myC , you can set and export the shell variable with a line like this:
ccC+/usr/bin/myC;export ccC
Note that you have to export the variable. If you are using the c-shell:
setenv ccC /usr/bin/myC
The variables used by CC are:
| Variable | Default | Function |
| CCROOTDIR | /usr/CC/‘arch‘ | C++ for this architecture |
| CCLIBDIR | $CCROOTDIR | C++ for this architecture |
| I | $CCROOTDIR/incl | Directory for include files |
| LIBRARY | $CCROOTDIR/libC.a | Standard C++ library-full path |
| cfrontC | cfront | The translator itself |
| LIB_ID | C | If LIBRARY not set, used to build name of C++ library by replacing x in libx.a |
| ccC | cc | C compiler |
| cppC | /lib/cpp | C preprocessor |
| SYS | bsd4.3 | System type |
| CPLUS | -Dc_plusplus=1.3 | 1.2 cpp C++ constant for |
| backward compatibility | ||
| cPLUS | -D__cplusplus=1 | 2.0 cpp C++ constant for |
| ANSI C conformance | ||
| cplusfiltC | $CCROOTDIR/c++filt | C++ link error message filter |
These variables are maintained by CC. The only variable you can change is $CCROOTDIR. If C++ is installed in a different path than /usr/CC/’arch’, you can indicate this to CC by:
setenv CCROOTDIR /myCC
Sun Release 4.0 — Last change: 20 July 1989