Request for Comment assert(__ctfe)

Stefan Koch uplink.coder at gmail.com
Mon Apr 6 13:41:52 UTC 2020


On Monday, 6 April 2020 at 10:14:24 UTC, Atila Neves wrote:
> On Sunday, 5 April 2020 at 12:11:23 UTC, Stefan Koch wrote:
>> Hi Guys,
>>
>> I am currently working on speeding up dmd. In the presence of 
>> templates and ctfe.
>> and one thing that stood out is that we do codegen for symbols 
>> which are never used.
>> (and hopefully eliminated by a smart linker but eh ...)
>>
>> [...]
>
> Wouldn't it be easier to skip codegen for private functions 
> that are never called from non CTFE contexts?

Easier from the user-perspective yes.
 From the compiler perspective,
That's another step which may take quite a while to do correctly.
The easy thing would be (Essentially an (N*M) loop over all calls 
and functions), which I doubt will help compile-times much.

For now assert(__ctfe); enables people to manually mark their 
ctfe-only, functions.


More information about the Digitalmars-d mailing list