C++ Interfacing:'static' array function parameter contradiction

Atila Neves via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 29 03:17:47 PDT 2017


On Saturday, 29 April 2017 at 06:22:03 UTC, ParticlePeter wrote:
> On Saturday, 29 April 2017 at 01:49:56 UTC, Atila Neves wrote:
>> On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote:
>>> [...]
>>
>> The worst part about that is mangling aside, the two 
>> declarations are identical to the compiler.
>>
>> Atila
>
> In this context, can anybody explain [1], in particular, in 
> this case, one should extern( C++ ) void cppSArray( ref 
> float[3] color );
>
> instead of:
> extern( C++ ) void cppSArray( float* color );
>
> Others and me in this discussion seem to agree that parameter 
> (float color[3]) is equivalent to (float* color) in C++ world.
>
> [1] http://dlang.org/spec/interfaceToC.html#passing_d_array

It's "just" the mangling. If it were `extern(C)` there'd be 
nothing to talk about.

Atila


More information about the Digitalmars-d-learn mailing list