For anybody who has followed this thread, there is some disagreement over the thread safety of shortstrings. And in this case, a shortstring with a clearly defined maximum length.
Some have clearly said string[30] is NOT thread safe. Rich indicated below he feels they ARE SAFE. Hmmm. Time for DOUBLE jeopardy. Alex Trebeck says, "I am the son of Ansistring but I don't move around much. My pointer is me and I am my pointer." Answer: What is a shortstring in Freepascal? I am going to err on the side of caution and take Michael Van Canneyt's version and implement it that way. I have to implement the same thread code in C++ a little later, so there are no shortstrings in C++, just QStrings. (oops, yeah, I use Qt also) Cheers, Marco On 6/4/2014 2:13 PM, Saunders, Rich wrote: > On 2014-06-04 13:22, m...@rpzdesign.com wrote: >> I guess what I was really asking is: >> >> Is there a way to treat an array of chars as a string. >> >> I like the string handling patterns of freepascal but I want >> the memory stability of a static array of chars >> so I can be used in multi-thread operations without >> a lot a critical section considerations. > > Short strings (those declared with a defined length) are not as dynamic > as you fear. They should stay in place while you change their values. > > The String type (declared without defined length) is the one that is > dynamic and reference counted. > _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal