Battle-plan for CTFE

Stefan Koch via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Aug 30 01:35:20 PDT 2016


On Tuesday, 30 August 2016 at 08:18:47 UTC, Johannes Pfau wrote:
>
> There are some nice use cases for this:
> * Do not enforce @nogc for CTFE only functions, so you can mark 
> a
>   complete module nogc: and CTFE only functions will get ignored
> * Do not emit code for CTFE only functions. This is useful for 
> bare
>   metal programming: The CTFE only function can depend on 
> druntime
>   functions not available in the bare metal runtime.
>
> These are common problems when using string mixins: The 
> functions
> to generate the mixed in code use string manipulation which is 
> usually
> not @nogc and might require runtime functions. But the code 
> generation
> function is exclusively used in CTFE.

I do not see how this could affect @nogc.
But yes you can circumvent the code-generation and pulling in the 
druntime dependency using a static if.


More information about the Digitalmars-d-announce mailing list