Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!pacbell.com!decwrl!infopiz!lupine!rfg From: rfg@NCD.COM (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: c++ name mangler sought Message-ID: <5503@lupine.NCD.COM> Date: 12 May 91 05:55:13 GMT References: <71574@microsoft.UUCP> <41560@ucbvax.BERKELEY.EDU> Distribution: usa Organization: Network Computing Devices, Inc., Mt. View, CA Lines: 43 In article <41560@ucbvax.BERKELEY.EDU> jbuck@janus.Berkeley.EDU (Joe Buck) writes: >... Consider a linker that can take arbitrarily long global symbol >names (many systems have these already). No problem, right? Now, eliminate >any restriction on what characters may appear in the global symbol name >(other than, say, a 0 byte to terminate it). Now, suppose you have >a prototype for a function > >int AClass::func(int,const char*,BClass&) const; > >What symbol should be searched for by the linker? Well, how about >"AClass::func(int,const char*,BClass&) const"? Who says you need to >mangle at all? Who indeed? >... cfront needs to do name mangling because it >produces C. But true C++ compilers don't need to do name mangling at >all; they only need a minor modification to the linker. Not quite true. Many "true" C++ compilers may still produce assembly code and assemblers tend to have their own restrictive rules regarding what does and does not constitute a valid assembly-level identifier. If you had a scheme where you could sneak arbitrary strings past the assembler (as identifiers) and get the assembler to write those strings into the object file, I suspect that you would be home free. I suggested in the UI/PLSIG awhile back that assemblers ought to have a special pseudo-op especiall for this purpose so that C++ compilers could say (for example): .alias test__Fif,"test(int i, float f)" Someone suggested that this was not a sufficient solution. I don't recall having asked that peoson why it was not. Perhaps it isn't, but I think that having this kind of a `.alias' pseudo-op would be most helpful for C++ compilers. -- // Ron ("Loose Cannon") Guilmette // Internet: rfg@ncd.com uucp: ...uunet!lupine!rfg // New motto: If it ain't broke, try using a bigger hammer.