Re: name mangling

Discussion in 'C++' started by tonytech08, Nov 3, 2008.

  1. tonytech08

    tonytech08 Guest

    On Nov 3, 1:37 am, "Megalo" <> wrote:
    > why not make "name mangling" of C++ standard so should be possible
    > to call
    > the classes and the functions of C++ from other C++ compiler
    > [and other language too]
    > thanks


    Wasn't name mangling implemented because of unevolved linker
    technology when C++ was being designed? Something about not being able
    to associate type information with symbols in a linker? And doesn't
    modern linker technology provide mechanisms that would make name
    mangling obsolete? Perhaps not all compilers do mangling anymore??
     
    tonytech08, Nov 3, 2008
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    tonytech08 wrote:
    > Wasn't name mangling implemented because of unevolved linker
    > technology when C++ was being designed? Something about not being able
    > to associate type information with symbols in a linker? And doesn't
    > modern linker technology provide mechanisms that would make name
    > mangling obsolete? Perhaps not all compilers do mangling anymore??


    You can associate type information by adding type name to the function
    name. That's how that information is (in general) stored. Technology
    wasn't a problem. If you wanted not to change the symbol string *and*
    store type information you would have to invent new executable and/or
    relocatable files format (or improve existing ones), what is not a good
    idea.

    If all compilers used the same name mangling convention, there wouldn't
    be such problem, despite the fact that name mangling would still be done.

    Anyway, I don't think that it is a C++ standard thing to indirectly
    create C++ compliant executable and/or relocatable file format.

    Pawel Dziepak

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (GNU/Linux)
    Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

    iEYEARECAAYFAkkPW34ACgkQPFW+cUiIHNqK+QCglQtOd+7WPAsiUIdlkwaHePkg
    8ukAn0i3E5/bwTnI7niGSWG9CdJAkfzU
    =CFmT
    -----END PGP SIGNATURE-----
     
    Pawel Dziepak, Nov 3, 2008
    #2
    1. Advertising

  3. tonytech08

    James Kanze Guest

    On Nov 3, 9:13 pm, Pawel Dziepak <> wrote:
    > tonytech08 wrote:
    > > Wasn't name mangling implemented because of unevolved linker
    > > technology when C++ was being designed? Something about not
    > > being able to associate type information with symbols in a
    > > linker? And doesn't modern linker technology provide
    > > mechanisms that would make name mangling obsolete? Perhaps
    > > not all compilers do mangling anymore??


    > You can associate type information by adding type name to the
    > function name. That's how that information is (in general)
    > stored. Technology wasn't a problem. If you wanted not to
    > change the symbol string *and* store type information you
    > would have to invent new executable and/or relocatable files
    > format (or improve existing ones), what is not a good idea.


    Why not? I uses a linker as early as 1979 which supported
    additional information about the function (other than just the
    name). Mangling was introduced as a quick and dirty solution to
    make things work with an existing linker (which was primitive
    even by the standards back then). It turned out to work fairly
    well, however, so no one has been motivated to develope other
    solutions.

    > If all compilers used the same name mangling convention, there
    > wouldn't be such problem, despite the fact that name mangling
    > would still be done.


    The problem isn't that names are mangled differently. The
    problem is that classes are laid out differently.

    --
    James Kanze (GABI Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
     
    James Kanze, Nov 3, 2008
    #3
  4. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    James Kanze wrote:
    > Why not? I uses a linker as early as 1979 which supported
    > additional information about the function (other than just the
    > name). Mangling was introduced as a quick and dirty solution to
    > make things work with an existing linker (which was primitive
    > even by the standards back then). It turned out to work fairly
    > well, however, so no one has been motivated to develope other
    > solutions.


    Currently, on the majority of unix systems the main format is ELF which
    doesn't provide such possibilities to save type information in other way
    than modifying symbol's name. Of course, changing/improving that format
    would make many things easier, but breaking compliance is not affordable
    for people and companies that creates systems. Problems that would
    appear are just more serious that benefits you can take from introducing
    such format.

    Pawel Dziepak
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (GNU/Linux)
    Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

    iEYEARECAAYFAkkPgFEACgkQPFW+cUiIHNrTyQCfcYSjpzx+LbLpceunror5Rmix
    iQgAn3GVputZ8So5E9LXECIej4cYdHA+
    =0QjE
    -----END PGP SIGNATURE-----
     
    Pawel Dziepak, Nov 3, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. abhijeet.s
    Replies:
    8
    Views:
    4,501
    Jean-Francois Briere
    Feb 3, 2006
  2. sunny

    Name Mangling in DDK

    sunny, Jul 9, 2004, in forum: C++
    Replies:
    4
    Views:
    466
    Robert Wessel
    Jul 10, 2004
  3. Tim Slattery

    Name-mangling standard?

    Tim Slattery, Sep 2, 2004, in forum: C++
    Replies:
    1
    Views:
    1,869
    Thomas Matthews
    Sep 2, 2004
  4. Randy Yates
    Replies:
    2
    Views:
    528
    Randy Yates
    Jan 4, 2005
  5. Replies:
    6
    Views:
    417
    E. Robert Tisdale
    Sep 8, 2005
Loading...

Share This Page