Identifier too long - Should this be considered a bug?

Daniel Keep daniel.keep.lists at gmail.com
Sat Oct 13 02:46:47 PDT 2007



Janice Caron wrote:
> I've just been writing this program. It's very heavy on templates.
> 
> I guess I just added one alias too many. My latest compile failed with
> the error message:
> 
> Error: identifier ... is too long by 2210 characters.
> 
> (I snipped the actual identifier name for obvious reasons). So
> basically, an alias expands to a template which contains other aliases
> which in turn expand to templates - and so on out to many levels. I
> had this really cool and beautiful code going, when suddenly - wham!
> Proceed no further!
> 
> Why should there be an arbitrary limit on compiler-generated identfier names?
> 
> The human-readable names were all of reasonable length, but the
> mangled name that the compiler comes up with is too long for itself.
> 
> To me, this feels like a compiler bug. I don't feel that I, as a
> programmer, did anything wrong. Why should there be a limit to how
> deeply one can nest template parameters?
> 
> Anyway, I put this to the rest of you. Do we care? Can we call this a
> bug? Or am I just wanting too much?

If I remember correctly, this is a limitation of the OBJ file format
that the DMD backend produces.  This in turn is what DMD's linker uses.
 The linker that's written entirely in assembler, and no one wants to
touch.  ;)

I seem to recall something a while back about taking the mangled names
and compressing them, but I'm not sure what happened with that.

Although I do think this shouldn't really happen, it only crops up every
once in a blue moon.  As far as I can remember, the only other person to
hit this was Kirk.  Given that fixing this properly would mean
significant changes to the linker and the DMD backend, and that the
limit is pretty huge anyway, I'm not sure if this should be a priority.

	-- Daniel



More information about the Digitalmars-d mailing list