Why this code can't take advantage from CTFE?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 3 07:59:43 PST 2016


On Wednesday, 3 February 2016 at 15:34:51 UTC, Andrea Fontana 
wrote:
>         enum first = very_very_long_function(10);
>         auto second = very_very_long_function(12);
>
> Why second init doesn't work with CTFE?

You never asked for CTFE.

CTFE only happens when it *has* to - when you write code that 
specifically asks for or requires it.

Ordinary variables don't require ctfe, so they don't get it.


More information about the Digitalmars-d-learn mailing list