Best interface for memcpy() (and the string.h family of functions)
Mike Franklin
slavo5150 at yahoo.com
Thu May 30 01:35:05 UTC 2019
On Thursday, 30 May 2019 at 01:19:54 UTC, kinke wrote:
> In D, there's no ugly and unsafe need to pass slices to memcpy,
> as a simple `dst[] = src[]` can do the job much better, boiling
> down to a memcpy (with 3rd param) if T is a POD (and the two
> slices don't overlap, have the same length etc. if bounds
> checks are enabled).
This is an important observation. My vision for the GSoC project
was targeted primarily at druntime. D memcpy would rarely, if
ever, be invoked directly by most users. Expressions like `dst[]
= src[]` and other assignment expressions that require memcpy as
part of their behaviro, would be lowered by the compiler to the
runtime memcpy template.
Mike
More information about the Digitalmars-d
mailing list