A Case for Oxidation: A potential missed opportunity for D

SrMordred patric.dexheimer at gmail.com
Fri Jun 29 11:57:00 UTC 2018


>  and non-template-only Phobos.

> unless they are using betterC (undefined reference to 
> '_d_arraycopy')?

Are you sure about this?

//flags: -betterC -noboundscheck
extern(C):
void main()
{
     import core.stdc.stdlib;
     int[] x = ( cast(int*) malloc( int.sizeof * 10 ) )[0 .. 10];
     int[] y = ( cast(int*) malloc( int.sizeof * 10 ) )[0 .. 10];

     import std.algorithm : map;

     x.map!( x => x * 2 );

     x[] = y[];
}

//compiles and works ok.





More information about the Digitalmars-d mailing list