From C to D: issue with arguments for core.stdc.string.memcpy

Alec Stewart alec-stewart at protonmail.com
Fri Feb 22 18:23:29 UTC 2019


On Friday, 22 February 2019 at 16:38:10 UTC, Meta wrote:
> On Wednesday, 20 February 2019 at 20:57:26 UTC, Mike Parker 
> wrote:
>> On Wednesday, 20 February 2019 at 20:46:42 UTC, Alec Stewart 
>> wrote:
>>
>>>[...]
>>
>> You're passing a static array where the function expects a 
>> pointer.
>>
>> memcpy(s.stack.buffer.ptr, input, n);
>
> To expand on this just a bit, in case you're not familiar with 
> D, arrays in D do not decay to a pointer like they do in C. You 
> need to pass s.stack.buffer.ptr instead.

Ah, that makes sense! Thank you all!


More information about the Digitalmars-d mailing list