Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoking GCC as "cc" versus "gcc"

I am aware that on most GNU/Linux systems, GCC can be invoked by the name "cc" from the command line (as opposed to "gcc"). Is there any difference in GCC's behavior when it is invoked one way versus the other?

For example, I know that invoking GCC through the name "g++" instead of "gcc" causes GCC to behave differently (it treats .c files as C++ source and links-in the C++ standard library). Is there any similar difference in behavior between "gcc" versus "cc"?

EDIT: None of the answers received so far gave a definitive "yes" or "no" as to whether GCC will behave differently if invoked one way versus the other. However, the idea given to dive into the source to check its behavior lead me down that path. Based upon what I found there, I now believe that the answer is:

No. GCC behaves the same regardless of whether it is called via "gcc" or "cc".

like image 568
Dan Moulding Avatar asked Jun 02 '09 14:06

Dan Moulding


People also ask

Is GCC and CC the same?

CC is the name given to the UNIX Compiler Command. It is used as the default compiler command for your operating system and also is executable with the same command. GCC, on the other hand, is the GNU Compiler operating system.

What is cc compiler in Linux?

cc command is stands for C Compiler, usually an alias command to gcc or clang. As the name suggests, executing the cc command will usually call the gcc on Linux systems. It is used to compile the C language codes and create executables. The number of options available for the cc command is very high.

Which GCC option should be used to do compilation?

The different options of gcc command allow the user to stop the compilation process at different stages. Most Useful Options with Examples: Here source. c is the C program code file. -o opt: This will compile the source.

When GCC is invoked what does is normally do?

Chapter 4. GCC Command Options. When you invoke GCC, it normally does preprocessing, compilation, assembly and linking.


1 Answers

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.

like image 156
plinth Avatar answered Oct 06 '22 08:10

plinth