DMD 1.022 and 2.005 releases

Regan Heath regan at netmail.co.nz
Wed Oct 10 09:05:26 PDT 2007


BLS wrote:
> Bill Baxter schrieb:
>> BLS wrote:
>>> 0ffh schrieb:
>>>
>>>> With the help of explicit pointers and dereferencing, I can see no 
>>>> trouble
>>>> except you'll need a lot of stars... :)
>>>>
>>>> Regards, Frank
>>>>
>>>> ps. btw. plain C doesn't have &refs either
>>>
>>> Would be nice if you are willing to offer an example.
>>> It could also be used as example on :
>>> http://www.prowiki.org/wiki4d/wiki.cgi?PortingFromCxx
>>> thanks in advance, Bjoern
>>
>> He just means have the function return Foo* instead of Foo&.  And then 
>> use (*foo) everwhere instead of plain foo on calling side.  That's 
>> pretty much the only reasonable solution I can see.
>>
>> --bb
> Thanks for clarification Bill. Wonder why Frank wrote : "except you'll 
> need a lot of * " ?
> Bjoern
> 

I assumed he meant something like:

-- C++ --
void foo(int &i)
{
   ..lots of uses of 'i' eg "i = 5"..
}

-- D --
void foo(int *i)
{
   ..lots of uses of '*i' eg "*i = 5"..
}

each usage of a converted ref parameter will require a *.

The other problem here however is the call site:

-- C++ --
int i;
foo(i);

-- D --
int i;
foo(&i);

Regan



More information about the Digitalmars-d-announce mailing list