On 10/11/2010 00:16, Jonathan M Davis wrote:
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
No, that's completely wrong.
CTFE should result in constant initialisation values, eg stuff in the
.exes read only data segment.
CTFE is the same as:
immutable string _someString = "hello world!";
Expect that it's:
immutable string _someString = reallyComplicatedCTFEfunction();
--
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk