memcpy() comparison: C, Rust, and D
Nordlöw via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jan 31 01:31:23 PST 2017
On Tuesday, 31 January 2017 at 01:30:48 UTC, Walter Bright wrote:
> Rust:
> pub unsafe extern fn memcpy(dest: *mut c_void,
> src: *const c_void,
> n: size_t)
> -> *mut c_void
> D:
> pure void* memcpy(return void* s1, scope const void* s2,
> size_t n);
> 2. The return value is derived from s1.
How can we be sure that the return value points to the same
content as `s1`? If that is what you mean by "derived".
> The Rust declaration does not give us 1, 2 or 4 (because it is
> marked as unsafe). If it was safe, the declaration does not
> give us 2.
I don't see how Rust doesn't provide information 2 aswell. Is it
because of differences in the meaning of `const` in Rust compared
to D?
More information about the Digitalmars-d
mailing list