string types: const(char)[] and cstring

Jarrett Billingsley kb3ctd2 at yahoo.com
Sun Jun 3 10:05:59 PDT 2007


"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. 





More information about the Digitalmars-d-announce mailing list