gcc is the driver. It will invoke actually different front-end according to file extension or forcibly -x.
But for g++, it'll force to treat source files as c++ by default, even your file is (*.c) (lowercase).
Why not have a simply trial to convience your self:
echo "int main() { } " > test.c
gcc -v -c test.c
[Please not the /usr/libexec/gcc/i386-redhat-linux/4.1.2/cc1plus line, which is the actual front-end compiler]
========================
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
/usr/libexec/gcc/i386-redhat-linux/4.1.2/cc1 -quiet -v test.c -quiet -dumpbase test.c -mtune=generic -auxbase test -version -o /tmp/ccUiF4Qr.s
ignoring nonexistent directory "/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/i386-redhat-linux/4.1.2/include
/usr/include
End of search list.
GNU C version 4.1.2 20080704 (Red Hat 4.1.2-46) (i386-redhat-linux)
compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-46).
GGC heuristics: --param ggc-min-expand=59 --param ggc-min-heapsize=55455
Compiler executable checksum: 435964263b657ac05d988fae7b6714b1
as -V -Qy -o test.o /tmp/ccUiF4Qr.s
GNU assembler version 2.17.50.0.6-12.el5 (i386-redhat-linux) using BFD version 2.17.50.0.6-12.el5 20061020
=============================
mv test.c test.cpp
gcc -v -c test.cpp
=============================
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
/usr/libexec/gcc/i386-redhat-linux/4.1.2/cc1plus -quiet -v -D_GNU_SOURCE test.cpp -quiet -dumpbase test.cpp -mtune=generic -auxbase test -version -o /tmp/ccUgae0u.s
ignoring nonexistent directory "/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward
/usr/local/include
/usr/lib/gcc/i386-redhat-linux/4.1.2/include
/usr/include
End of search list.
GNU C++ version 4.1.2 20080704 (Red Hat 4.1.2-46) (i386-redhat-linux)
compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-46).
GGC heuristics: --param ggc-min-expand=59 --param ggc-min-heapsize=55455
Compiler executable checksum: 2c84476b74368e297382b43d14e53b01
as -V -Qy -o test.o /tmp/ccUgae0u.s
GNU assembler version 2.17.50.0.6-12.el5 (i386-redhat-linux) using BFD version 2.17.50.0.6-12.el5 20061020
================================
mv test.cpp test.c
g++ -v -c test.c
You'll get the same result as gcc + test.cpp, which means compiled as C++.
cc is the C front end
cc1plus is the C++ front end. That's it.