Invoking GCC as "cc" versus "gcc" Invoking GCC as "cc" versus "gcc" c c

Invoking GCC as "cc" versus "gcc"


For grins, I just traced down how argv[0] is used from within gcc (main.c -> top_lev.c -> opts.c -> langhooks.c) and it appears that argv[0] is currently used for nothing more than giving malloc something to report when it fails. There doesn't appear to be any behavior change if argv[0] is anything other than gcc.


It looks to me that cc (link to some old SUS specification) is intended to be the vendor-neutral interface to the system's compiler. It's marked as legacy:

The c89 utility provides an interface to the ISO C standard, but the cc utility accepts an unspecified dialect of the C language: it may be Standard C, common-usage C or some other variant. Portable C programs should be written to conform to the ISO C standard and compiled with c89.

POSIX has a utility called c99 which I believe is the successor of c89. It says

The c99 utility is based on the c89 utility originally introduced in the ISO POSIX-2:1993 standard. Some of the changes from c89 include the modification to the contents of the Standard Libraries section to account for new headers and options; for example, added to the -l rt operand, and the -l trace operand added for the Tracing functions.

I'm not really familiar to all those different standards, but it looks like the more recent SUSv3 (POSIX:2004) and the yet more recent POSIX:2008 (doesn't seem to have a SUS number yet) do not specify a utility called cc anymore, but only the utility called c99. Incidentally, my Linux system (Arch_Linux) contains a manpage of c99 but not c89, but only contains a utility called cc, but neither c89 nor c99. Much confusion in there :)


On my mac from man gcc:

In Apple's version of GCC, both cc and gcc are actually symbolic links to a compiler named like gcc-version. Similarly, c++ and g++ are links to a compiler named like g++-version.

Based on that I would assume that cc and gcc behave the same way.