Return by 'ref' problems...
Remo
remotion4d at googlemail.com
Wed Feb 19 13:36:44 PST 2014
Excellent, this way is much better.
Thanks you artur.
On Wednesday, 19 February 2014 at 19:55:30 UTC, Artur Skawina
wrote:
> On 02/19/14 17:20, Remo wrote:
>>
>> This code does compile.
>> [code]
>> ref int min(ref int lhs,ref int rhs) {
>> return lhs > rhs ? rhs : lhs;
>> }
>> auto fptr = &min;
>>
>> pragma(msg,typeof(fptr).stringof); //int function(ref int
>> lhs, ref int rhs) ref
>> [/code]
>>
>> But how to manually specify type of fptr?
>>
>> This does not compiles
>> [code]
>> int function(ref int lhs, ref int rhs) ref fptr3 = &min;
>> //Error: no identifier for declarator int function(ref int
>> lhs, ref int rhs)
>> [/code]
>>
>> this one too.
>> [code]
>> ref int function(ref int lhs, ref int rhs) fptr3 = &min;
>> //Error: only parameters or foreach declarations can be ref
>> [/code]
>
> alias extern(C) ref int function(ref int lhs, ref int rhs)
> Ftype;
> Ftype fprt;
>
> artur
More information about the Digitalmars-d
mailing list