CTFE bug causes null check to pass on null pointers (Issue 7602)

Jens Mueller jens.k.mueller at gmx.de
Wed Mar 21 03:22:09 PDT 2012


David Nadlinger wrote:
> On Wednesday, 21 March 2012 at 09:51:43 UTC, Jens Mueller wrote:
> >Interesting. How do I make use of this?
> >
> >[…]
> >
> >What's the trick to use memory allocated in a CTFE. Say e.g. I
> >want to
> >build a tree at compile time using CTFE.
> 
> You can't do that right now (i.e. converting CTFE-allocated memory
> to initializers for run-time values), but it enables you to use
> classes, etc. _during_ CTFE.

Just for clarification:
Why do you say "initializers for _run-time_ values"? I believe I just
want to allocate memory at compile-time.

I just found out you are not allowed to return an instance. But you can
use out parameters. That means I can achieve what I have in mind using
classes. Even though it looks a bit clumsy and not like I do it in
non-CTFE code.

Many Thanks.

Jens


More information about the Digitalmars-d mailing list