Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!newsfeed.internetmci.com!in2.uu.net!allegra!alice!ark
From: ark@research.att.com (Andrew Koenig)
Subject: Re: Will Java kill C++?
Message-ID: <Dpt0FD.Et4@research.att.com>
Organization: AT&T Research, Murray Hill NJ
References: <31683229.446B9B3D@bbn.com> <DpJs8I.8tn@research.att.com> <4kn3c4$1ggc@piglet.cc.uic.edu>
Date: Sat, 13 Apr 1996 14:04:24 GMT
Lines: 80
Xref: glinda.oz.cs.cmu.edu comp.lang.java:39908 comp.lang.c++:184478 comp.lang.smalltalk:37236

In article <4kn3c4$1ggc@piglet.cc.uic.edu> dhanle2@icarus.cc.uic.edu (David James Hanley) writes:
> andrek koenig wrote:

Is your transformation of my name supposed to be clever?
To make you feel like a better, more noble person?
To make your arguments more intellectually compelling?
To show the world that you enjoy insulting strangers?

> : In article <31683229.446B9B3D@bbn.com> Joe Kraska <jkraska@bbn.com> writes:

> : > ANSI-C libraries are much easier to handle than C++ 
> : > libraries, for a whole host of reasons, not the least of which is
> : > the stupid-dumb-fuck-mistake of not having a name-mangling standard
> : > for C++.

> : The thing about hurling expletives around like that
> : is that it's so embarrassing when you're wrong -- as
> : you are in this case.

> 	Or that he is correct, as he is in this case.

Correct about what?  That having a name-mangling standard for C++
would make C++ libraries easier to handle.  Sorry, but he's wrong,
and so are you.

Name mangling, that is, the conventions that a compiler uses
in translating names from the source program into names
that the linker sees, is only one of a large number of things
that must be agreed before programs compiled with one compiler
can be linked with programs compiled with another.  If some
of those things are made compatible and not others, that can
easily make the problems worse instead of better.  The reason
is that programs may appear to work compatibly when in fact
they are working only by accident.

> : Having a name-mangling standard would not solve any
> : problems, because it would do nothing toward solving
> : the binary compatibility problems that affect not
> : only C++ but also C.

> 	Really?  I'll have to remember that next time I like a gnu C
> compiled program with a sun c compiled program.  

> : I have two mutually incompatible C compilers on my workstation.
> : They generate names that look the same to the linker, but they
> : put arguments and return results in different registers.

> 	That's too bad.  All of mine link ok.

Well, good for you.  That still does not gainsay the fact that
handing the same names to the linker does not make compilers
compatible.

> : Getting a single binary library to work with both those
> : C compilers is no easier than it is in C++.

> 	Wrong.  As evidence, we do this all the time in C,
> but I've never seen it done in C++. 

I completely agree with you that link compatibility between C++
compilers is more difficult to achieve, hence less common, than
link compatibility between C compilers.

But agreeing on a standard for name mangling would not solve that
problem, because it is vanishingly rare that two C++ compilers are
binary compatible in all details except for names.

> :  In fact, I can
> : plausibly argue that it would be easier if those two compilers
> : used different conventions for linkage names -- that way I could
> : tell when I was headed for a fall before trying to run the
> : program.

> 	I see.  Running the program once during the development cycle would
> be too much effort.

More to the point, it wouldn't prove anything if it appeared to work.
-- 
				--Andrew Koenig
				  ark@research.att.com
