Reimplementing software building blocks like malloc and free in D

Mike Franklin slavo5150 at yahoo.com
Sun Aug 12 08:50:34 UTC 2018


On Sunday, 12 August 2018 at 07:00:30 UTC, Eugene Wissner wrote:

>> Also what about other implementations like memset or memcmp. 
>> Have they been implemented or require work from scratch?
>
> These functions are still mostly implemented in asm, so I'm not 
> sure there is an "idiomatic D" way. I would only wrap them into 
> a function working with slices and checking the length. Mike?

It is also not only the implementation that's "idiomatic D", but 
also the interface.  For example, I find `void copy(T)(const ref 
T from, ref T to)` to be much more "idiomatic D" than `void* 
memcpy(void* to, const void* from, size_t size)`.

Mike


More information about the Digitalmars-d mailing list