string types: const(char)[] and cstring

Sean Kelly sean at f4.ca
Sun Jun 3 10:46:33 PDT 2007


Jarrett Billingsley wrote:
> "Sean Kelly" <sean at f4.ca> wrote in message 
> news:f3uoj5$1b1i$1 at digitalmars.com...
> 
>> Most array algorithms would apply.  But I'm still not sure I see the point 
>> of having an immutable reference, because it's just passed by value 
>> anyway.  Who cares if the size of the array is modified within a function 
>> where it's not passed by reference?  The change is just local to the 
>> function anyway.
> 
> If that array is pointing into some meaningful area of memory (like in the 
> example, a texture buffer), resizing the array could (probably would) move 
> the array around, which I guess isn't illegal but then the function 
> operating on the array wouldn't be accessing the correct place.  Prevent 
> them from changing the length, it prevents them from accessing anywhere but 
> there. 

Well yeah.  I don't personally think this is a problem because it 
doesn't affect the callee in any way, but I can see how others might 
disagree.  Doesn't 'final' do this now though?


Sean



More information about the Digitalmars-d-announce mailing list