[0m


CC(1)		    UNIX Programmer's Manual		    CC(1)



[1mNAME
     [0mcc - C compiler

[1mSYNOPSIS
     cc [0m[ option ] ... file ...

[1mDESCRIPTION
     [0m_C_c is the C compiler. _C_c accepts several types of arguments:

     [1mo	[0mArguments whose names end with ._c or ._i are taken to be C
	source programs; they are compiled, and each object pro-
	gram is left on the file whose name is that of the source
	with ._o substituted for ._c.  The ._o file is normally
	deleted, however, if a single C program is compiled and
	loaded all at one go.

     [1mo	[0mArguments whose names end with ._s are taken to be assem-
	bly source programs and are assembled, producing a ._o
	file.

     [1mo	[0mArguments whose names end with ._o are assumed to be
	already compiled and are passed to _l_d without change.

     The order of arguments on the command line is significant -
     the arguments to the corresponding call to _l_d are in the
     same order, and _l_d is very order sensitive.  See _l_d(1).

[1mOPTIONS
     [0mThe following options are interpreted by _c_c.  See _l_d(1) for
     load-time options.

     [1m-c   [0mSuppress the loading phase of the compilation, and
	  force an object file to be produced even if only one
	  program is compiled.

     [1m-g   [0mHave the compiler produce additional symbol table
	  information for _d_b_x(1).  Some optimisations are turned
	  off by this option.

     [1m-w   [0mSuppress warning diagnostics.

     [1m-p   [0mArrange for the compiler to produce code which counts
	  the number of times each routine is called.  If loading
	  takes place, replace the standard startup routine by
	  one which automatically calls _m_o_n_i_t_o_r(3) at the start
	  and arranges to write out a _m_o_n._o_u_t file at normal ter-
	  mination of execution of the object program.	An execu-
	  tion profile can then be generated by use of _p_r_o_f(1).
	  The option causes the program to be linked with
	  /_u_s_r/_l_i_b/_m_c_r_t_0._o and the profiling version of the C
	  library, /_u_s_r/_l_i_b/_l_i_b_c__p._a.




Printed 30/11/92    Revision 1.12 of 26/11/90			1






CC(1)		    UNIX Programmer's Manual		    CC(1)



     [1m-pg  [0mCauses the compiler to produce counting code in the
	  manner of [1m-p, [0mbut invokes a run-time recording mechan-
	  ism that keeps more extensive statistics and produces a
	  _g_m_o_n._o_u_t file at normal termination.	Again, a profil-
	  ing library is searched, in lieu of the standard C
	  library.  An execution profile can then be generated by
	  use of _g_p_r_o_f(_1). The output is linked with the special
	  startup file /_u_s_r/_l_i_b/_g_c_r_t_0._o and the profiling
	  library.

     [1m-O   [0mAllows the compiler to perform additional optimisa-
	  tions.  Usually all optimisations are enabled anyway,
	  except when compiling with the [1m-g [0moption.

     [1m-R   [0mMake string-literals read-only (and, hence, sharable).

     [1m-S   [0mCompile the named C programs, and leave the assembly-
	  language output on corresponding files suffixed ._s.

     [1m-M   [0mRun only the macro preprocessor on the named C pro-
	  grams, requesting it to generate Makefile dependencies
	  and send the result to the standard output.

     [1m-E   [0mRun only the macro preprocessor on the named C pro-
	  grams, and send the result to the standard output.

     [1m-C   [0mprevent the macro preprocessor from eliding comments.

     [1m-o [0m_o_u_t_p_u_t
	  Name the final output file _o_u_t_p_u_t.  If this option is
	  not used the output of a load step will be produced in
	  the file _a._o_u_t.  If used in conjunction with the [1m-c
	  [0moption, [1m-o [0m_n_a_m_e renames the generated object file.

     [1m-D[0m_n_a_m_e[1m=[0m_d_e_f

     [1m-D[0m_n_a_m_e
	  Define the _n_a_m_e to the preprocessor, as if by [1m#define[0m.
	  If no definition is given, the name is defined as [1m1[0m.

     [1m-U[0m_n_a_m_e
	  Remove any initial definition of _n_a_m_e.

     [1m-I[0m_d_i_r
	  [1m#include [0mfiles whose names do not begin with `/' are
	  always sought first in the directory of the _f_i_l_e argu-
	  ment, then in directories named in [1m-I [0moptions, then in
	  directories on a standard list.  If no _d_i_r argument is
	  supplied the argument following [1m-I [0mis used.

     [1m-j[0m_d_i_r[1m,[0m_d_i_r[1m,[0m...
	  Replace the standard list for [1m-I [0mby _d_i_r[1m,[0m....	If no



Printed 30/11/92    Revision 1.12 of 26/11/90			2






CC(1)		    UNIX Programmer's Manual		    CC(1)



	  list is provided the argument following [1m-j [0mis used.  To
	  disable the standard list (to remove all entries from
	  it) use [1m-j [0mfollowed by an empty argument.

     [1m-e [0m_e_p_s_y_m
	  This option is passed to _l_d(1).

     [1m-L[0m_d_i_r
	  Library archives are sought first in directories named
	  in [1m-L [0moptions, then in directories on a standard list.
	  This option is simply passed to _l_d(1).

     [1m-r   [0mThis option is passed to _l_d(1).

     [1m-s   [0mThis option is passed to _l_d(1).

     [1m-u [0m_s_y_m_n_a_m_e
	  This option is passed to _l_d(1).

     [1m-l[0m_l_i_b_r_a_r_y
	  The option is passed through to _l_d(1).  It causes _l_d to
	  load the library whose name is [1mlib[0m_l_i_b_r_a_r_y[1m.a [0mfrom the
	  library load path.

     [1m-b[0m,[1m-B

     -f[0m,[1m-F

     -k[0m,[1m-K

     -x[0m,[1m-X

     -z[0m_C_h_a_r_s,[1m-Z[0m_C_h_a_r_s
	  Are all reserved to Acorn. Future compilers may inter-
	  pret, or ignore these flags or may pass them on to _l_d.
	  Unadorned [1m-z [0mis passed directly to _l_d (_1).

     In addition to flag letters, the following keywords are
     recognised:

     [1m-help
	  [0mOutput a summary manual entry for _c_c.

     [1m-list
	  [0mGenerate a line-numbered compiler listing in a file
	  with extension ._l_s_t.

     [1m-ansi
	  [0mCompile C to December 1989 [1mANSI [0mSpecification.

     [1m-strict
	  [0mUsed in conjunction with [1m-ansi[0m.  It sets up neither



Printed 30/11/92    Revision 1.12 of 26/11/90			3






CC(1)		    UNIX Programmer's Manual		    CC(1)



	  X/Open nor BSD environments and guarantees only ANSI C
	  and access to the ANSI library functions.

     Other arguments are taken to be either loader option argu-
     ments, or C-compatible object programs, typically produced
     by an earlier _c_c run, or perhaps libraries of C-compatible
     routines.	These programs, together with the results of any
     compilations specified, are loaded (in the order given) to
     produce an executable program with default name [1ma.out.

FILES
     [0mfile.c		input file
     file.o		object file
     a.out		loaded output
     /usr/bin/cc	compiler front-end (X/Open)
     /usr/ucb/cc	compiler front-end (BSD)
     /usr/lib/cc	compiler
     /usr/lib/crt0.o	runtime startoff
     /usr/lib/mcrt0.o	startoff for profiling
     /usr/lib/gcrt0.o	startoff for gprof-profiling
     /usr/lib/libc.a	standard library, see _i_n_t_r_o(3)
     /usr/lib/libc_p.a	profiling library, see _i_n_t_r_o(3)
     /usr/include	standard directory for [1m#include [0mfiles
     mon.out		file produced for analysis by _p_r_o_f(1)
     gmon.out		file produced for analysis by _g_p_r_o_f(1)

[1mSEE ALSO
     [0mB. W. Kernighan and D. M. Ritchie, _T_h_e _C _P_r_o_g_r_a_m_m_i_n_g
     _L_a_n_g_u_a_g_e, Prentice-Hall, 1978
     B. W. Kernighan, _P_r_o_g_r_a_m_m_i_n_g _i_n _C-_a _t_u_t_o_r_i_a_l
     D. M. Ritchie, _C _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l
     monitor(3), prof(1), gprof(1), adb(1), ld(1), dbx(1), as(1),
     aupcs(7), afp(7)

[1mDIAGNOSTICS
     [0mThe diagnostics produced by C itself are intended to be
     self-explanatory.	Occasional messages may be produced by
     the assembler or loader.  By default _c_c links with the
     shared library version of libc, /_l_i_b/_l_i_b_c._a.  This can lead
     to symbol clashes which would not occur in a non-shared
     environment.  It is possible to link with the non-shared
     version of the library /_l_i_b/_l_i_b_c__n._a using _l_d but it is
     better to remove the symbol clashes from the program in
     question.

[1mDIFFERENCES BETWEEN ACORN CC AND BSD CC
     -go  [0mis not supported (no support for sdb).

     [1m-R   [0mmakes string and floating point literals read-only and
	  sharable, rather than making all initialised variables
	  read-only and sharable (by putting them in the text
	  segment).



Printed 30/11/92    Revision 1.12 of 26/11/90			4






CC(1)		    UNIX Programmer's Manual		    CC(1)



     [1m-f   [0mis not supported: float expressions are always con-
	  verted to double (but register float variables work
	  anyway).

     [1m-B -t
	  [0mare not supported: there are no separate compiler
	  passes, and there are no substitutes.

[1mPREPROCESSOR DIFFERENCES
     o	[0mWhitespace and line breaks are treated differently. This
	principally affects _c_c [1m-E [0mand _c_p_p: their output may have
	line breaks in different places and may be differently
	spaced. The outputs of RISC _i_X's _c_c [1m-E [0mand _c_p_p commands
	cannot be compared directly with those of the 4.3BSD
	UNIX's _c_c [1m-E [0mand _c_p_p commands.

     [1mo	[0mThe white-space control characters vertical-tab ([1mVT[0m),
	form-feed ([1mFF[0m), and carriage-return ([1mCR[0m) (ASCII codes 11,
	12, and 13) are silently converted to newline ([1mNL[0m).
	Literal [1mVT[0m, [1mFF[0m, and [1mCR [0mshould not be used in character
	and string literals.

     [1mo	[0mThe [1mANSI #elif [0mconstruct is permitted.

     [1mo	[0mThe [1mANSI #error [0mconstruct is permitted.

     [1mo	[0mThe [1mANSI #pragma [0mconstruct is permitted.

     [1mo	[0mThe [1mANSI #if defined ... [0mconstruct is permitted.

     [1mo	[0mThe following [1mANSI [0mpre-defined macros can be used (and
	can be re-defined): [1m__DATE__[0m, [1m__FILE__[0m, [1m__LINE__[0m, and
	[1m__TIME__[0m; [1m__arm [0mand [1m__unix [0mare defined (and can be re-
	defined); [1m__STDC__ [0mis defined by _c_c [1m-ansi[0m; one of [1m_BSD_C
	[0mand [1m_XOPEN_C [0mwill be defined unless _c_c [1m-ansi -strict [0mis
	used (depending on how the compiler is invoked).

[1mLEXICAL AND SYNTACTIC DIFFERENCES
     o	[0mThe archaic [1m=+ [0mis not accepted in place of [1m+=[0m; similarly
	[1m=-[0m, [1m=*[0m, etc.

     [1mo	[0mThe keywords [1masm[0m, [1mentry [0mand [1mfortran [0mare faulted.

     [1mo	[0mThe [1mANSI [0mmodifiers [1mf [0m(or [1mF[0m) and [1mu [0m(or [1mU[0m) can be used in
	conjunction with [1ml [0m(or [1mL[0m) to denote floating, unsigned,
	and long values, respectively. For example: [1m2lf [0m(double
	2.0); [1m3u [0m(unsigned 3); [1m4l [0m(long 4).

     [1mo	[0mThe [1mANSI [0mimplicit concatenation of adjacent string seg-
	ments is permitted.  Thus [1m"[0m_H_e_l_l_o[1m" "[0m_W_o_r_l_d[1m" [0mis treated as
	[1m"[0m_H_e_l_l_o_W_o_r_l_d[1m"[0m.




Printed 30/11/92    Revision 1.12 of 26/11/90			5






CC(1)		    UNIX Programmer's Manual		    CC(1)



     [1mo	[0mThe [1mANSI [0mescape sequences [1m\a [0mand [1m\xnn [0mcan be used within
	strings and character constants to denote the ASCII BEL
	character and a hexadecimal character code, respectively.
	As [1m\a [0mand [1m\x [0mare meaningless in pcc-style C, existing
	usage can only be accidental.

     [1mo	ANSI [0mfunction prototypes may be used. These give precise
	information about a function's arguments and result type.
	Such prototypes may include use of the [1mANSI [0m"[1m...[0m" to
	denote a variable number of arguments following. For
	example:

		 [1mextern int funct(int a, float b, ... );

     o	[0mUse of the [1mANSI [0mgeneric pointer type [1mvoid * [0mis permitted.

[1mSEMANTIC, SCOPE, AND OTHER DIFFERENCES
     [0mAn identifier declared with storage class [1mextern [0mhas normal
     scope. If such an identifier is not declared at the outer-
     most level then it does not have file scope.

     A function's formal arguments are considered to be defined
     at the head of the outermost block of the function. Thus,
     they may not be redefined within this block.

     A [1mstruct [0mor [1munion [0mfield name may only be used to select a
     component from an expression of the appropriate type. The
     archaic and abominable:
	       [1mstruct {int a, b;};
	       double d;
	       d.b = 0;
	       ...
     [0mis faulted.

     New type names defined using [1mtypedef [0mmay not have modifiers
     applied to them. Thus code such as:
	       [1mtypedef int t1;
	       unsigned t1 a;
     [0mis faulted.

     The type of a variable may not be multiply defined or rede-
     fined. Thus, code such as:
	       [1mlong x[3];
	       int x[3];
     [0mis faulted.

     The braces around a struct or array initialiser may not be
     partly omitted.  For example, consider:
	       [1mtypedef struct {
		    struct {
			 int a,b;
		    } c[3];



[0mPrinted 30/11/92    Revision 1.12 of 26/11/90			6






CC(1)		    UNIX Programmer's Manual		    CC(1)



	       [1m} T;

     [0mThe following initialisers are accepted:
	       [1mstatic T v1 = {1,2,3,4,5,6};
	       static T v2 = {{{1,2}, {3,4}, {5,6}}};

     [0mHowever, the initialiser:
	       [1mstatic T v3 = {{1,2}, {3,4}, {5,6}};
     [0mis faulted.

     As in  [1mANSI C[0m, union types may be initialised. The initiali-
     sation applies to the first arm of the union.

     As in  [1mANSI C[0m, the extended precision floating-point type
     [1mlong double [0mis available.

[1mBUGS
     [0mIn [1m-ansi -strict [0mmode, empty initialisers are not faulted.
     For example:
	       [1mint x[3] = {} ; /* un-caught constraint violation */
     [0mSigned constant integer overflow is also not faulted. For
     example:
	       [1mcase LONG_MAX *4 : /* un-caught constraint violation */
     [0mA cast to a pointer to volatile T loses the volatile qualif-
     ier. For example:
	       [1my = * (( volatile int *)x) ;
	       y = * (( volatile int *)x) ; /* CSE'd with above, not treated as volatile */




























[0mPrinted 30/11/92    Revision 1.12 of 26/11/90			7



[0m