[comp.lang.c++] C++ produced symbols & sdb

root@sdd.UUCP (03/29/87)

	Thanks for the answers to my previous question about UNIFY
and C++.  Creating a "good old C" function called udelete() that
calls the UNIFY record deletion function called delete() solved
my problem.

	Why does C++ change the name of all local symbols (auto symbols)
to _auN_xxxx where N is the lexical level.  Is there any reason, that
I should not eliminate the section of code that modifies the symbol
name (at lease for non-overloaded local symbols)?  I have tried it
and it seems to work.

	This provides the user with the ability to debug C++ programs
utilizing sdb without having to type strange names for local symbols.

	On the same line, does anyone know of other symbol translations
that I can eliminate to make debugging even easier (such as the
structure / class prefixes for their members of type (__SCREEN_xxxx)!

							Daniel Corbett
							VP Engineering,
							Software Design & Development Corp.

bs@alice.UUCP (03/30/87)

There are two reasons for the mangling of names of (apparently)
non-overloaded names.

Through derivation a class may have several members of the same name
and you and the compiler must have a way of distinguishing them:

	struct B {
		int a;
		int f();
	};

	struct D : B {
		int a;
		int f(int x) { a = x; B::a = x+1; }
	};

	void ff() {
		D d;
		d.f(2);
		d.B::f();
	}

Names used in inline functions must be ``mangled'' so that the C compiler
can distinguish between global names, names local to the inline function,
and names local to the calling function:

	int a;

	inline f(int a) { return ::a = a++; };

	void g()
	{
		int a;
		int b = f(a);
	}

You can strip the mangeling off to make debugging interaction easier
(though you loose information), but you cannot strip it off so that
the C compiler does not see it without breaking programs.