string types: const(char)[] and cstring

Tom S h3r3tic at remove.mat.uni.torun.pl
Sat Jun 2 16:46:18 PDT 2007


Walter Bright wrote:
> Derek Parnell wrote:
>> What is the syntax for an immutable array of mutable characters?
> 
> There isn't one. Such a construct is appealing in the abstract, but I 
> haven't run across a legitimate use for it yet.

Are we only talking strings here or general arrays? Because if general 
arrays are concerned, I can come up with an example.

An immutable array of mutable data for... e.g. render to texture in a 
software renderer (or creating data for a hw texture, or whatnot) So you 
basically pass a texture buffer to a function. You don't want it to 
realloc the buffer, just to modify its contents...

What am I missing here? ;)


-- 
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode



More information about the Digitalmars-d-announce mailing list