memcpy() comparison: C, Rust, and D

Olivier FAURE via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 31 02:17:09 PST 2017


On Tuesday, 31 January 2017 at 01:30:48 UTC, Walter Bright wrote:
> 3. Nothing s2 transitively points to is altered via s2.

Wait, really? Does that mean that this code is implicitly illegal?

import core.stdc.string;

     void main()
     {
         int*[10] data1;
         int*[10] data2;

         memcpy(data1.ptr, data2.ptr, 10);
     }

Since memcpy is @system, I have no way to know for sure (the 
compiler obviously won't warn me since I can't mark main as 
@safe), so I'd argue the prototype doesn't carry that information.


More information about the Digitalmars-d mailing list