pragma(__ctfe)

Bruce Carneal bcarneal at gmail.com
Thu Sep 28 04:58:00 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.

The assert hack is useful but limited.  It will not fail at 
compile time, will not prevent all code/symbol generation, will 
not enable compile time understanding that the function is 
restricted to use at compile time (if that's useful apart from 
the other ...).

I think we can do better in this area (eliminating/controlling 
spew to the linker) and in target enumeration generally {CT, 
generic CPU, CPU specializations, dcompute variants} but not 
without quite a bit more effort for the generality and/or 
soup-free analysis.



More information about the Digitalmars-d mailing list