No CTFE of function

Cecil Ward via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 28 06:23:49 PDT 2017


On Monday, 28 August 2017 at 03:16:24 UTC, Mike Parker wrote:
> On Sunday, 27 August 2017 at 17:47:54 UTC, Cecil Ward wrote:
>> [...]
>
> The rules for CTFE are outlined in the docs [1]. What is 
> described there is all there is to it. If those criteria are 
> not met, the function cannot be executed at compile time. More 
> importantly, as mentioned earlier in the thread, CTFE will only 
> occur if a function *must* be executed at compile time, i.e. it 
> is in a context where the result of the function is required at 
> compile-time. An enum declaration is such a situation, a 
> variable initialization is not.
>
> [...]

Those links are extremely useful. Many thanks. Because I am full 
of NHS pain drugs, I am pretty confused half the time, and so 
finding documentation is difficult for me through the haze, so 
much appreciated. RTFM of course applies as always.


More information about the Digitalmars-d-learn mailing list