inverse of std.demangle?

Adam D. Ruppe destructionator at gmail.com
Thu Jul 11 05:01:06 PDT 2013


On Wed, Jul 10, 2013 at 06:30:57PM -0700, H. S. Teoh wrote:
> I think this is a general problem of array and AA literals allocating at
> runtime (and sometimes *every single time* the literal is used).

Right, unless they are static immutable (which disqualifies them
for CTFE I believe).

This sucks hard and needs to be fixed.



Anyway though, I just accepted one initial allocation there and killed
the others. (Now, I could avoid this one too, by manually sorting the
array and writing it out as static data. But I'm lazy.)

Here's the updated file:
http://arsdnet.net/dcode/mangle.d

My internet is crapping out, again, so not even sure this email will
send but I'll try anyway!


As you can see (if you can actually download the code, if not try again
in a few hours, my internet has been flaky this time of night for the
last few weeks, but it comes back) it uses all static buffers now
to avoid random concat allocations.

There's also a unittest showing that it works for more complex function
declarations too. This wasn't as hard as I was expecting!

Still buggy and incomplete but maybe usable as it is now. When my 'net is
back to normal, I'll add it to my github too.



More information about the Digitalmars-d-learn mailing list