Board index » cppbuilder » AnsiString , StringList 's AnsiString question
Timothy H. Buchma
![]() CBuilder Developer |
Tue, 25 Mar 2003 03:00:00 GMT
AnsiString , StringList 's AnsiString question
I'm sure someone else can give you a more technical explanation, but
the fact is that an AnsiString is an instance of a class, not a memory address to be dereferenced. It's just plain wrong to think of the variable name as an allocated memory address. That applies even more to a TStringList. You should not be "able" to write into the middle of a complex component; You should have to ask the Methods of the object to make changes for you. It's a fact that you can use the property myStringList->Strings->Text to tamper with all the strings at once. Perhaps that property should not have been exposed, because you could destroy the object that way... A comparable issue would be how in various versions of BCB it has and has not been possible to *set* one character in an AnsiString with the [] operator: myStr[i]='a'; A more advanced topic (not related to your current testing) is that copies of AnsiStrings are reference counted. -- slave of linux <wm...@ksts.seed.net.tw> wrote in message Quote> Hi all, |