On reflection my reply was misleading, or even downright wrong... :-}

StrAlloc and StrNew _in particular_ are in decline, because in the cases
where you want to have a few of bytes preceeding the string to hold string
length information you're better off using an AnsiString - that's what they
do best.  So when you want to create a PChar explicitly, you'll almost never
want the extra overhead of those four bytes of length information, and
consequently you should use GetMem/FreeMem.

Cheers,
Carl

>> From: Colin Fraser [mailto:[EMAIL PROTECTED]]
>> Is StrAlloc and StrDispose the way to go, or is GetMem and FreeMem 
>> fine... or doesn't it matter???
>
> From: Carl Reynolds [mailto:[EMAIL PROTECTED]]
> I think the reason StrAlloc is marked as being in decline is just that
> explicit creation of PChars is in decline.  That's because you can now use
> pascal strings (string or AnsiString) in most cases, use SetLength, and
pass
> PChar(MyString) as needed.  But when you do need to create PChars, either
> StrAlloc or GetMem will do.
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to