ch-ch-changes

Daniel Keep daniel.keep.lists at gmail.com
Thu Jan 29 03:29:41 PST 2009



grauzone wrote:
> Don wrote:
>> grauzone wrote:
>>> For one, I'm sure that this will generate an additional gazillion of
>>> nearly useless linker symbols with very long names.
>>
>> No. That happens with templates, not CTFE. Excluding the CTFE bug, of
>> course.
> 
> Has nothing to do with CTFE. For example, the following code
> 
>> void foo(char[] T)(int x) {}
>> void main() {    foo!("hello")(3);   }
> 
> Will produce an object files, which contains the following symbol:
> 
>> _D1g25__T3fooVG5aa5_68656c6c6fZ3fooFiZv
> 
> I don't know if this will ever become an issue, but optlink.exe already
> crashes often enough.

That symbol isn't "nearly useless," it has the code for foo!("hello")
attached to it... I mean, it has to go *somewhere*.

That said, D does tend to generate a fair number of spurious symbols.  I
personally think that D's linker should learn how to clean up after it's
messy compiler cousin, but then I don't have time to write a linker.

If you're complaining that the symbol is hard to read then, yes, it is.
 But that's what happens when you encode the full type signature of the
template into the symbol.

In any case, if the name is too long to fit within the limits of OMF, I
believe D deflate-compresses the symbol to shorten it.

As far as I'm aware, there's no way around this.  At the end of the day,
you have to store this stuff.

  -- Daniel



More information about the Digitalmars-d mailing list