V2 string

Walter Bright newshound1 at digitalmars.com
Wed Jul 4 15:48:45 PDT 2007


Derek Parnell wrote:
> I'm converting Bud to compile using V2 and so far its been a very hard
> thing to do. I'm finding that I'm now having to use '.dup' and '.idup' all
> over the place, which is exactly what I thought would happen. Bud does a
> lot of text manipulation so having 'string' as invariant means that calls
> to functions that return string need to often be .dup'ed because I need to
> assign the result to a malleable variable. 
> 
> I might have to rethink of the design of the application to avoid the
> performance hit of all these dups.
> 

First of all, if you were returning string literals as char[] and trying 
to manipulate them, they'd fail on linux at run time (because string 
literals are put into read only segments).

Second, you can use char[] instead of string.



More information about the Digitalmars-d mailing list