Path: utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ARKESDEN.ENG.SUN.COM!tiemann From: tiemann@ARKESDEN.ENG.SUN.COM (Michael Tiemann) Newsgroups: gnu.g++ Subject: Shorter names Message-ID: <8909210321.AA26997@arkesden.sun.com> Date: 21 Sep 89 03:21:12 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@sun.com Distribution: gnu Organization: GNUs Not Usenet Lines: 32 In an effort to generate shorter mangled names, here is something compilers can do, but only if all compilers that must interoperate adopt the convention. There seem to be a number of names which are almost always found being used in C++ programs: Integer, String, Object, etc. We could build a dictionary of all classnames that are found in existing implementations, sorted by apparent frequency of usage, and then these names could be refered to by their index in the dictionary. Suppose that `ostream' is index 2 and `Integer' is index number 10. Then the function ostream& Integer::PrintOn(ostream&) would be mangled as PrintOn__D10D2 instead of PrintOn__7Integer7ostream This has the problem of adding significant state to an implementation definition of a C++ compiler, so one might want to limit it to say the 100 most common class names. It would not be hard to implement: using Doug Schmidt's `gperf' program, a perfect hashing function could be used to generate code that all C++ compiler implementors could use for efficient lookup and consistent name-index associations, and the code for the function could be published as a standard. I am not proposing that this be done immediately, but it might be something to think about. Michael