Value vs. reference semantics, and pointers

Oskar Linde oskar.lindeREM at OVEgmail.com
Fri Mar 24 01:16:20 PST 2006


Bruno Medeiros wrote:
> Oskar Linde wrote:
>> Scott L. Burson wrote:
>>> I also have a question about the treatment of pointers.  I understand 
>>> that
>>> out/inout parameters and reference semantics for classes and arrays will
>>> eliminate the vast majority of occasions calling for explicit 
>>> pointers, but
>>> still, I'm curious.  In D, can you make a pointer to a single object 
>>> as in C, or
>>> does it have to be in an array?
>>
>> You can still make pointers to anything just like in C.
>>
> That is not correct (and you know it, have you forgotten?).

I fail to see what's wrong with my statement. Maybe the word "still".
But you are correct that this needs some clarification.

> A static array (and by static array we mean an array of fixed size, as 
> C's arrays) is neither a proper value or reference type. It is an odd 
> mix of the two, and IMO a bad discrepancy. Perhaps this is something D 
> could be improved upon. (don't a formed ideia how, though)
> Dynamic arrays (dynamic length arrays) are "a bit more" than a reference 
> type, but they behave pretty much as reference type, so one can consider 
> them as such.



More information about the Digitalmars-d mailing list