using memset withing a pure function

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 14 19:29:06 PDT 2015


On Saturday, 15 August 2015 at 02:21:46 UTC, D_Learner wrote:
> On Saturday, 15 August 2015 at 01:13:02 UTC, Adam D. Ruppe 
> wrote:
>> On Saturday, 15 August 2015 at 01:09:15 UTC, D_Learner wrote:
>>> When writting a pure fucntion involving C non pure functions 
>>> like
>>>  memcpy() and   memset()
>>
>> Those functions are pure already, and marked so in the newest 
>> dmd (and I think older ones too, though I haven't confirmed.
>>
>> Your code compiled out of the box for me.
>>
>> BTW D also has some syntax sugar for them:
>>
>> arr[start .. end] = 0; // memset those bounds to 0
>> arr[start .. end] = arr2[start .. end]; // memcpy
>
> Well, the actual error I got is :  Error: memset cannot be 
> interpreted at compile time, because it has no available source 
> code . I seems to suggest I miss the actual code.

this is another thing. Here you reach the CTFE limits.


More information about the Digitalmars-d-learn mailing list