[ROOT] _R__UNIQUE is not so unique

From: Roger Moore (rwmoore@fnal.gov)
Date: Tue Sep 17 2002 - 20:45:47 MEST


I recently upgraded from ROOT 3.03/05 tp 3.03/07 and suddenly found that
code generated by rootcint would no longer compile giving errors of the
ilk:

"GtCut.hpp", line 166: error: variable "R__dummyholder166" has already been
          defined

Having a look at the ClassImpT macro and tracing it back up the macro tree
I found that it essentially instantiates a global symbol using the macro:

	_R__UNIQUE(R__dummyholder)

which relies on the macro _R__UNIQUE (in RConfig.h) to generate a unique
symbol each time. However all it does is tack the current line number onto
the given argument which, if you ever have more than one file, is not
unique.

Other than adding blank lines here and there throughout the code (to
ensure that no two ClassImpT calls are on the same line!) I see no way to
avoid this. I thought about moving from a system of grouped LinkDef.h
files (where I have one LinkDef.h per directory) to separate linkdef
files for each class. However my guess would be that this could cause
problems at link time with the symbols clashing then.

Could this please be fixed? If it remains as it is then ROOT code becomes
dependent on the line number where you write it which I don't think is a
desirable feature.

Thanks,

Roger



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:10 MET