ponce

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 9 16:16:14 PST 2010


On Tuesday, November 09, 2010 13:49:12 bearophile wrote:
> Jonathan M Davis:
> > it would be possible to make it so that any objects allocated with
> > new during CTFE would be in the dynamic heap during runtime.
> 
> This is possible, but it doesn't seem what you usually desire when you
> allocate an object at compile time.

Why not? CTFE stuff should either disappear in the binary, because it's not 
needed anymore, or it should be the same as if it were created at runtime. CTFE 
is a great opportunity to create more complicated stuff at cheaper cost (since 
the calculations are done at compile time instead of runtime), and more 
importantly, have compile-time constants which are more complex. It's also a 
great way to generate code. But I don't see why you'd want statically-created 
objects to be treated differently once the program is running.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list