A Case for Oxidation: A potential missed opportunity for D

rikki cattermole rikki at cattermole.co.nz
Fri Jun 29 11:24:52 UTC 2018


On 29/06/2018 11:17 PM, kinke wrote:
> On Friday, 29 June 2018 at 11:04:30 UTC, rikki cattermole wrote:
>> It greatly simplifies development against existing C/C++ codebases.
> 
> How so? By telling people you can express C++:
> 
> void cpy(char *dst, const char *src, size_t size)
> {
>      for (size_t i; i < size; ++i)
>          dst[i] = src[i];
> }
> 
> elegantly and safe like this in D:
> 
> void cpy(void[] dst, void[] src) { dst[] = src[]; }
> 
> unless they are using betterC (undefined reference to '_d_arraycopy')? 
> Just to highlight one lost language feature.

It is a language feature yes, and it doesn't define /how/ it gets 
implemented.

In fact the spec[0][1] implies that it generates highly optimized 
assembly, not go and call a function.

[0] https://dlang.org/spec/simd.html
[1] https://dlang.org/spec/arrays.html#array-copying


More information about the Digitalmars-d mailing list