DMD 1.022 and 2.005 releases

BLS nanali at nospam-wanadoo.fr
Wed Oct 10 09:13:06 PDT 2007


Regan Heath schrieb:
> 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"..
> }
> 

I think :
void foo(ref int i){}
will do the Job in D
( But function parameters are not part of the problem )
Thanks, Bjoern

> 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