🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3010

Re: Name-mangling standard

#3010
From: Jonathan de Boyne Pollard
Date: Fri, 12 Jan 1996 19:24
48 lines
3175 bytes
John Galt (jgalt@infosoft.com) wrote:
: > I certainly hope not!  Name mangling is a solution to passing type
: > information to 1950's linkers.  Once linkers become more sophisticated,
: > name mangling can disappear back into the slime from which it came.
:
: I beg to differ.  Name mangling serves several indispensible functions:
:
: 1.  It makes it possible to have more than one function with the same name
: (differing in their argument lists).  To do this without mangling, the linker
: would have to see not just a function name, or even class::name, but a full
: _prototype_ for each function (omitting variable names and the result type).

Why is this a problem ?  The *existing* name mangling schemes now in use
carry around all of the information in the prototype (in encoded form).
The only change from a "name mangling" system to an "intelligent linker"
system would be that the object module format recognised by the linker
would have special records to store the function signature information,
rather than storing that information in the name of the function.

In other words, your implication that eliminating name mangling would
require *more* information to be passed to the linker is plainly untrue.

: On systems like the PC, with multiple pointer formats, this could also be
: used to check that all modules (including library code) were compiled with
: the same (or compatible) memory model.  I think it is really stupid that none
: of the compilers for the PC makes this possible by including the memory model
: in mangled names.

What PC C++ implementations have you been using ?  All of the ones that I
use (that support 16:32 pointers in addition to 0:32 pointers) include 
far/near qualifications as part of the mangling scheme :

MetaWare High C++
-----------------
void n ( char * p )		-> n@qpc$v
void n ( char _Far * p )	-> n@qpzfzc$v

Watcom C++
----------
void n ( char * p )		-> W?n$n(pna)v
void n ( char __far * p )	-> W?n$n(pfa)v

In other words, "quality of implementation".  Use a better implementation.
Try one of the above two if you like.
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <4d68l4$f3@silver.jba.co.uk>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
References: <20c.32169.607@newage.com.ar> <4bsnbu$5mu@mujibur.inmind.com> <30EDC013.7C780E5E@cims.nyu.edu> <DL1pqE.KKq@infosoft.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: JdeBP@jba.co.uk (Jonathan de Boyne Pollard)
Newsgroups: comp.std.c++
Subject: Re: Name-mangling standard
Date: 12 Jan 1996 11:24:37 PST
Organization: JBA Software Products, Studley, England.
Approved: austern@isolde.mti.sgi.com
Message-ID: <4d68l4$f3@silver.jba.co.uk>
References: <20c.32169.607@newage.com.ar> <4bsnbu$5mu@mujibur.inmind.com> <30EDC013.7C780E5E@cims.nyu.edu> <DL1pqE.KKq@infosoft.com>
Reply-To: JdeBP%utopium@jba.co.uk
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 12 Jan 1996 18:18:12 -0000
X-Newsreader: TIN [version 1.2 PL2]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMPa1nEy4NqrwXLNJAQGtHQH/Q8UZY1UX81FBd6Rze7V/ndc+I/q9isGw
 SIzXEdjA9t3zfxwAa5mNIrIT+xXuebEQkt6ajq73auFKfl97NmFuOA==
 =ZAEV
Originator: austern@isolde.mti.sgi.com