memcpy, memset, memcmp and friends in the D Runtime

Daniel Murphy yebbliesnospam at gmail.com
Thu Apr 10 05:22:49 PDT 2014


"Dmitry Olshansky"  wrote in message news:li5lfd$203s$1 at digitalmars.com... 

> Pros:
> 
> 1. No extra scuffolding for CTFE.
> 2. Type-safe
> 3. Optional (non-release, etc.) bounds-checking.
> 4. Less error prone interface, e.g. memset is a known source of bugs in 
> C, even for tried and true code bases.
> 5. More flexible, see e.g. memchr as an example.
> 
> Cons:
> A set of primitives to learn.

I don't know why you'd ever use memcpy/memset when you have:

arr[] = 0;
foreach(ref v; arr)
    v = 0;
etc


More information about the Digitalmars-d mailing list