pragma(__ctfe)

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Sep 28 07:36:10 UTC 2023


On Thursday, 28 September 2023 at 03:35:10 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> I certainly would prefer ``assert(__ctfe);``.
>
> It would opt-in existing code (correctly). That alone is a 
> pretty convincing argument.
>
> Not having to learn additional things, and having what appears 
> like it should work work is always a good design choice.

That would suffer all the same problems that `pragma(inline)` as 
a statement has. The information that a function should not be 
emitted (or should be inlined) is an outward facing attribute of 
that function, not an internal facing attribute. It will screw up 
.di generation, and make separate compilation more difficult. You 
also can't flip a switch to change if from not emitting to 
emitting it if you want to debug the function at runtime.


More information about the Digitalmars-d mailing list