char[]/ubyte[] compile error

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Thu Jul 13 15:06:24 PDT 2017


On Thursday, 13 July 2017 at 22:03:37 UTC, Johan Engelen wrote:
> On Thursday, 13 July 2017 at 13:02:23 UTC, John Colvin wrote:
>>>
>>> Array
>>> {
>>>     size_t length;
>>>     char* ptr;
>>> }
>>>
>>> [1] http://dlang.org/spec/abi.html#arrays
>>
>> I do this for interacting with Cython and it works well for me.
>
> I think such a C-like construct that is equivalent with slices 
> really should be part of Phobos/druntime somehow. What do you 
> think John?

What I mean is, a construct like your "Array" on the D-side, that 
is automatically convertable from/to a slice on the D-side. Such 
that you can define cross-C++-D functions that accept slices on 
the D-side, and accepts Array structs on the C++ side, and all is 
mangled properly because the D-side is also using the Array 
struct yet still accepting slices.


More information about the digitalmars-d-ldc mailing list