Implementing Pure Functions

Walter Bright newshound2 at digitalmars.com
Thu Jun 16 11:47:22 PDT 2011


On 6/16/2011 5:27 AM, Kagamin wrote:
> Jimmy Cao Wrote:
>
>>> pure int square(int x)
>>> {
>>>     auto fp = cast(fp_t)&square_debug;
>>>     return (*fp)(x); // dereference???
>>> }
>>>
>>
>> Yes, that's correct.
>
> You mean, implementation-defined?

It's typed as pointing to a pure function. So, it's callable from a pure function.


More information about the Digitalmars-d mailing list