Replacing C's memcpy with a D implementation

Kagamin spam at here.lot
Sun Jun 10 15:12:27 UTC 2018


On Sunday, 10 June 2018 at 12:49:31 UTC, Mike Franklin wrote:
> There are many reasons to do this, one of which is to leverage 
> information available at compile-time and in D's type system 
> (type sizes, alignment, etc...) in order to optimize the 
> implementation of these functions, and allow them to be used 
> from @safe code.

In safe code you just use assignment and array ops, backend does 
the rest.

On Sunday, 10 June 2018 at 13:27:04 UTC, Mike Franklin wrote:
> But one think I discovered is that while we can set an array's 
> length in @safe, nothrow, pure code, it gets lowered to a 
> runtime hook that is neither @safe, nothrow, nor pure; the 
> compiler is lying to us.

If the compiler can't get it right then who can?


More information about the Digitalmars-d mailing list