string types: const(char)[] and cstring

Derek Parnell derek at psych.ward
Sat Jun 2 20:13:48 PDT 2007


On Sat, 02 Jun 2007 18:25:46 -0700, Walter Bright wrote:

> Tom S wrote:
>> 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.
> 
> In general.
> 
> 
>> 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? ;)
> 
> We can all come up with an example, the more interesting case is is it a 
> compelling example? I'm not seeing that.

Define 'compelling'. 

The only workaround I can see is bit restrictive ...

  final TextureBuffer t = CreateTextureBuffer();

  RenderToBuffer( t );
  DoLighting(t);
  ...


-- 
Derek Parnell
Melbourne, Australia
"Justice for David Hicks!"
skype: derek.j.parnell



More information about the Digitalmars-d-announce mailing list