[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.15.6 Qualified names

Both C++ and Java allow a class to be lexically nested inside another class. C++ also supports namespaces (not yet implemented by G++). Java also supports packages.

These are all mangled the same way: First the letter `Q' indicates that we are emitting a qualified name. That is followed by the number of parts in the qualified name. If that number is 9 or less, it is emitted with no delimiters. Otherwise, an underscore is written before and after the count. Then follows each part of the qualified name, as described above.

For example Foo::\u0319::Bar is encoded as `Q33FooU5_03193Bar'.

Squangling utilizes the the letter `K' to indicate a remembered portion of a qualified name. As qualified names are processed for an identifier, the names are numbered and remembered in a manner similar to the `B' type compression code. Names are recognized left to right, and given increasing values, which are appended to the code in the standard manner. ie, multiple digit numbers are delimited by `_' characters.

For example
 
class Andrew 
{
  class WasHere 
  {
      class AndHereToo 
      {
      };
  };
};

f(Andrew&r1, Andrew::WasHere& r2, Andrew::WasHere::AndHereToo& r3) { }

   K0 ->  Andrew
   K1 ->  Andrew::WasHere
   K2 ->  Andrew::WasHere::AndHereToo
Function `f()' would be mangled as : `f__FR6AndrewRQ2K07WasHereRQ2K110AndHereToo'

There are some occasions when either a `B' or `K' code could be chosen, preference is always given to the `B' code. Ie, the example in the section on `B' mangling could have used a `K' code instead of `B2'.



This document was generated by system on December, 2 2004 using texi2html