Mail Archives: djgpp/1997/06/24/08:35:53
On Mon, 23 Jun 1997, Liam wrote:
> Art S. Kagel <kagel AT ns1 DOT bloomberg DOT com> wrote:
> > You do not show the comand line that you used. I suspect that you named
> > your 'hello' program hello.c even though it contains C++ code and the 'C'
>
> > parser does not know what to do with it. You probably should have called
> > the file hello.cc.
> Can't it tell the difference between C and C++ code
> with out relying on the extension of a file?
No. The syntax parser phase for C and C++ are two completely different
executables. Gcc needs to know which to start up. Since the syntax is
about 80% the same gcc would have to scan a large percentage of your
program to decide. In addition, since you can use pure "C" syntax in C++
modules that do not need OO features it might make the wrong choice and
compile a particular module for "C" and not be able to successfully link
later as C++ requires function name mangling and "C" compilers do not
produce mangled function names.
Art S. Kagel, kagel AT bloomberg DOT com
- Raw text -