[GiNaC-devel] tinfo

Jens Vollinga vollinga at physik.uni-wuppertal.de
Thu Nov 10 15:47:34 CET 2005


Hi everybody,

just an idea for a better(?) tinfo mechanism in ginac:

if we added two static constants to every class like

class SOMECLASS
{
public:
	const static char* tinfo_name;
	const static unsigned tinfo;
// ... rest of class ...
}
const char* SOMECLASS::tinfo_name = "SOMECLASS";
const unsigned SOMECLASS::tinfo = (unsigned)SOMECLASS::idstring;

it seems that we would get a tinfo mechanism for ginac without having to 
set the tinfo numbers by hand.

But maybe I am mistaken. So I'd like to ask somebody who knows C++ 
better than me, if there might be some hidden pitfalls.

Is the conversion a problem (what about 64bit machines)?

Is it guaranteed that the address of the static string is unique to 
every class? Maybe some optimizer will break this? Does it only work 
with gcc on linux etc.?

Regards,
Jens



More information about the GiNaC-devel mailing list