Peter Gerwinski wrote:
- One that always makes a copy on the stack and copies the string into it. That's the secure way, but inefficient with very long strings.
Concerning CStrings? You mean a switch?
It could also be a switch. But wouldn't it be "cleaner" to write it as a function? "CStrFunc (Str2CStr (StrVar))" or so...
- One that allocates the memory on the heap. This is needed when the resulting CString is to be used outside of the current scope (when it's not only passed to a function).
- One that copies the string in a buffer allocated by the programmer (this is perhaps only for compatibility with BP's StrPCopy).
What functions do you mean? Built-in replacements for BP's functions from the `Strings' Unit?
Of course, they could be external functions as well. It's no problem to implement them in Pascal. But I think in the long run, all such standard functions will be built-in. -- Frank Heckenbach, Erlangen, Germany heckenb@mi.uni-erlangen.de http://home.pages.de/~fjf/links.htm
participants (1)
-
Frank Heckenbach