delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/24/08:35:53

Date: Tue, 24 Jun 1997 08:34:21 -0400 (EDT)
From: "Art S. Kagel" <kagel AT ns1 DOT bloomberg DOT com>
To: Liam <marl AT rmplc DOT co DOT uk>
Cc: John Syers <john DOT syers AT compaq DOT com>, djgpp AT delorie DOT com
Subject: Re: trouble compiling c++
In-Reply-To: <199706241043.KAA12868@mx2.rmplc.co.uk>
Message-Id: <Pine.D-G.3.91.970624083037.85A-100000@dg1>
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019