What C Compilers Are Available?


In general, for compiling C programs you should just use cc and it will do the right thing. Some platforms do have a choice of compilers. This allows you to switch if you are looking for an ANSI-C compiler where the native compiler is not ANSI. Also, some compilers optimize better than others. Supported compilers are ones that Athena believes will work well, that someone is willing to take bug reports about, and that you can get some help with. These are the supported C compilers on the various platforms:
Platform 	 Compiler 	 	ANSI 	POSIX
DECstation 	 cc (Mips C) 		Yes 	Yes
        	 gcc 			Yes 	Yes
RISC/6000 	 cc (IBM C) 		No 	Yes
        	 c89, xlc 		Yes 	Yes
Sun		 gcc			Yes	Yes
		 suncc			Yes	No
SGI		 cc			Yes	Yes
		 gcc			Yes  	Yes
Linux		 gcc			Yes	Yes
NetBSD		 gcc			Yes	Yes
These compilers span the range from traditional Kernighan and Ritchie C to strict ANSI C.

On the DECstations, the default cc compiler is from MIPS, the manufacturer of the CPU chip. This compiler has a good optimizer, but it is slow and its parser can become confused. It is truly ANSI compliant, and the libraries and header files on the DECstations are POSIX as well.

On the RISC/6000 the compiler is called xlc and is from IBM. The three compilers on this platform are actually the same compiler invoked with different switches. If invoked as cc, it will accept code that is not strict ANSI, as well as ANSI source. The other two invocations are much stricter and are often difficult to use.

On the Suns, Sunsoft has provided a compiler which is called suncc on Athena to avoid confusion with cc. To use first type:

add sunsoft
and then compile as you would with cc, or gcc, which is also available, and is the recommended compiler on the Suns.

The native Silicon Graphics C compiler "cc", is the best compiler to use for the SGI workstations. It is custom-tailored for the SGI's.

By default, "cc" behaves as if the option "-xansi" were set on the command line. Other available options include:

        -cckr           traditional K&R C
        -ansi           ANSI/ISO C
        -xansi          ANSI/ISO C with same defines as -cckr
        -ansiposix      ANSI/ISO C and POSIX compliance
The highest level of optimization is specified with the "-O3" flag. You may also want to use the "-mips2" option, which generates code using the MIPS 2 instruction set (MIPS 1 plus R4000-specific extensions). For more information about the MIPS 2 instruction set, and the /usr/lib/mips2 libraries, see the "mips2 (5)" manual page:

        athena%  man 5 mips2
see the answer:
	22* SGI Answers
	    7  What COMPILERs are on the SGI
for more information.

last updated: 3/16/96