This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++] Another question about demangler output


On Sat, Dec 06, 2003 at 10:30:26PM -0800, Zack Weinberg wrote:
>  template <class T> T foo (T x) { ... }
>  int bar;
>  bar = foo(bar);
[...]
> 
> (Hoom, one is not pleased that the abbreviation mechanism has made the
> identifier longer in this instance.  _Z3fooIiEii would be optimal.)

Not really.  There is a difference between T_ and i, at best you
could replace the S0_ substitution with T_, which is one
character shorter.

Consider

template <class T> T foo (T x) { }
int bar1 = foo(bar1);			// _Z3fooIiET_S0_
template <class T> T foo (int x) { }
int bar2 = foo<int>(bar2);		// _Z3fooIiET_i

This produces both, _Z3fooIiET_i and _Z3fooIiET_S0_

Also note that builtin types are not substituted
at all, so the S0_ is a substitution for T_, not
for i.

For example,

void foo (int, int*, int**) { }

is _Z3fooiPiPS_ and not _Z3fooiPS_PS0_

-- 
Carlo Wood <carlo@alinoe.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]