An integer index is just as effective as a pointer into a string. The
other issue you bring up is that strings are not null-terminated.
Since we constantly work with serial protocols that use null bytes, I
happen to think this is a very good thing. If you want to pass
substrings around without recopying, just pass an index and a length,
and have the receiving routine only look at those characters.
Don't forget about byte() and setbyte() when you're lamenting the lack
of pointers -- they make up for the fact that you can't index a string
like an array of characters.
Jeremy
toggle quoted message
Show quoted text
On Fri, Jan 23, 2009 at 5:16 PM, Chris Erskine <chris@...> wrote:
One of the things that I would do with pointers was for strings with delimiters, you would null out the delimiter and by using pointers, you could point to the start of the string without having to copy the data into new fields. There are a number of other uses that they can be used for but that was the one I was thinking about when Joseph talked about breaking up the XML files.
Chris