Walter Bright <[email protected]> wrote: > On 2/1/2017 9:22 AM, Tobias Müller wrote: >> You wouldn't use memcpy but just assign the slices. > > I clearly made a mistake in this example. I wanted to show how a compiler > learns > things from the declaration by using a very familiar declaration. But it > keeps > getting diverted into what people (and some compilers) "know" about memcpy > that > is not in the declaration.
I also showed you how memcpy could look like in Rust, I think it's only fair to also point out that this would be fairly unidiomatic. Apart from that, the entire point of building a safe wrapper around an unsafe FFI function is to exploit additional knowledge that is not present in the C declaration, but only in documentation. It's not relevant if that wrapper is built into the language or a library function. After all, to write the D declaration you also had to exploit that knowledge once.
