Baloff wrote:
how do find out what the command line flag that forces a C compilation
for my gcc 3.3.5-3, I am doing an exercise and am asked to note the
difference between C and C++ compilation of a code which uses puts()
without <stdio.h> in it.
I got on the C-h i gcc, it said in * G++ and GCC::
There is no intermediate C version of the program.
(By contrast, for example, some other implementations use a program
that generates a C program from your C++ source.)
You should post this Q to a gcc list. It's off topic here.
Anyhow, most compilers will key off the file name extension.
file.c -> C compiler
file.{cpp,c++,C,cxx,cc} -> C++ compiler
I found this by googling on "C cpp c++ cxx cc":
Compiler possible endings
GNU compiler g++ C cc cpp cxx c++
Watcom C++ -- cc cpp cxx c++
Borland C++ -- cc cpp cxx c++
SGI compiler CC C cc cpp cxx c++
DEC compiler cxx C cc cpp cxx --
However, if you're compiling a C++ program in gcc YOU MUST use "g++" for
the link phase and not gcc.
G