@ctfeonly
bauss
jj_1337 at live.dk
Fri Dec 8 09:59:34 UTC 2017
On Thursday, 7 December 2017 at 06:33:42 UTC, E.S. Quinn wrote:
> On Thursday, 7 December 2017 at 05:53:06 UTC, bauss wrote:
>> On Thursday, 7 December 2017 at 04:45:15 UTC, Jonathan M Davis
>> wrote:
>> As I understand it, with the way CTFE works,
>>> it pretty much can't know whether a function can be called at
>>> compile time until it tries
>>>
>>> - Jonathan M Davis
>>
>> I think that's the point of the attribute. You tell the
>> compiler that this function can only be called at compile-time
>> and any attempt to call it during run-time would be an error.
>
> If all you need is a runtime error, you can already put
> assert(__ctfe); in your function.
It's to avoid having a run-time error, so something that would
produce a run-time call gives a compile-time error.
More information about the Digitalmars-d
mailing list