memcpy, memset, memcmp and friends in the D Runtime

Mike none at none.com
Wed Apr 9 03:05:46 PDT 2014


On Monday, 7 April 2014 at 12:38:55 UTC, Steven Schveighoffer 
wrote:
> I think using using D's safer syntax of
>
> a[] = b[]
>
> and
>
> a[] = 0;
>
> Is much preferable to using memcpy/memset directly.
>
> They should do the "Right Thing", including calling 
> memcpy/memset when correct.
>
> -Steve

I received a very informative answer on D.learn 
(http://forum.dlang.org/post/xdnbfbdvruevjgqvbhfb@forum.dlang.org) 
that describes why a function that copies memory still may be 
needed:

"Depending on the type being copied, "a[] = b[]" is not straight
up "memory copy" it's the actual full assignment, with postblit
and all. That's why the call we want is *really* memcpy."

So, my question remains:  If I'm porting D to a platform that has 
no C library, shouldn't a public, supported function that copies 
memory be added in the D Runtime?



More information about the Digitalmars-d mailing list