new annotation or pragma to mark functions that are intended to be only used during compile time

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Feb 21 00:38:07 UTC 2025


On 21/02/2025 8:44 AM, Steven Schveighoffer wrote:
> On Thursday, 20 February 2025 at 17:42:25 UTC, Ilya wrote:
> 
>     On Thursday, 20 February 2025 at 15:50:33 UTC, Steven Schveighoffer
>     wrote:
> 
>         This has been proposed before, and it doesn't require language
>         changes:
> 
>         |void foo() { assert(__ctfe); } |
> 
>     Yes, I've seen that. But did it go anywhere? I think on the thread
>     I've found there are some discussions with no conclusion.
> 
> It has not gone anywhere, but if we were to consider a language change, 
> I'd want to evaluate whether this is a better option, since it's a de- 
> facto standard.

I wouldn't call it any kind of standard.

But since it cannot work at runtime, and can be seen during compilation 
it doesn't need a DIP to see this statement and turn off codegen for the 
function.

Hmm, I should be able to implement it, gimmie a bit.



More information about the dip.ideas mailing list