memcpy() comparison: C, Rust, and D
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jan 31 11:20:40 PST 2017
On 1/31/2017 5:50 AM, Richard Delorme wrote:
> Well, I would not have taken memcpy as an example in favor of D. Good C
> compilers (like gcc) know what memcpy does and are able to optimize it according
> to its arguments. DMD may know better about memcpy through its declaration but
> does not make any use about it.
That may be true, but is not my point. The compiler cannot have built in
knowledge of every function. I just used memcpy() as an example because it is
extremely well known.
As for making use of the type signature information, DMD uses it to check the
memory safety of arguments supplied to memcpy(), something gcc does not do.
More information about the Digitalmars-d
mailing list