Identifier too long - Should this be considered a bug?

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sat Oct 13 03:10:25 PDT 2007


(Daniel beat me to posting, but hadn't posted yet when I started typing 
this)

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?

You're using DMD on Windows, right? IIRC the object format it uses (OMF) 
places that restriction on the names.

You may want to try mingw-gdc (from 
http://sourceforge.net/project/showfiles.php?group_id=154306 or 
http://sourceforge.net/project/showfiles.php?group_id=168193).
I'm not sure if those packages includes a linker, if not, get the 
binutils from http://sourceforge.net/project/showfiles.php?group_id=2435.
I'm not sure what limits COFF (the object format mingw uses) places, but 
they're probably less restrictive than OMF since IIRC it's a newer format.

> 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?

This is a limitation that people have run into before (search the NGs, 
there should be earlier threads on this) but I'm not sure whether it can 
be considered a bug instead of a limitation of the toolchain.
Also, if I'm right that this is a restriction of OMF, the only way to 
fix it would be for DMD to switch object formats on Windows, which 
Walter IIRC said would be a lot of work.



More information about the Digitalmars-d mailing list