memcpy() comparison: C, Rust, and D
John Colvin via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jan 31 03:32:01 PST 2017
On Tuesday, 31 January 2017 at 10:17:09 UTC, Olivier FAURE wrote:
> 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.
Point 3 is about `const`, which as far as I know is unaffected by
application of @safe. Did you mean to quote a different point?
More information about the Digitalmars-d
mailing list