inverse of std.demangle?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jul 10 18:30:57 PDT 2013


On Thu, Jul 11, 2013 at 03:24:05AM +0200, Adam D. Ruppe wrote:
> On Wednesday, 10 July 2013 at 18:10:19 UTC, Sean Kelly wrote:
> >It would have to be done in a way that avoided allocating though
> >(similar to core.demangle), to be in core.
> 
> This would be really easy to do if enum string[] = [...]; didn't
> allocate at runtime.
> 
> Unbelievable.

I think this is a general problem of array and AA literals allocating at
runtime (and sometimes *every single time* the literal is used). We
really should have a way of generating array and AA literals in the
object file so that no runtime allocation is needed.

Runtime-generated literals really should only be used when there are
runtime variables involved in their construction, i.e., immutable x =
[1,2,y] can't be allocated at compile-time if y is a runtime variable,
but immutable x = [1,2,3] can and should be allocated at compile-time
and saved in the object file.


T

-- 
What's a "hot crossed bun"? An angry rabbit.


More information about the Digitalmars-d-learn mailing list