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

ParticlePeter via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 29 04:40:54 PDT 2017


On Saturday, 29 April 2017 at 10:17:47 UTC, Atila Neves wrote:
> 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

O.k. got it, so both D variants work with the same C++ mangling, 
thanks.


More information about the Digitalmars-d-learn mailing list