Re: Password Generator



On Sat, 29 Oct 2005 13:22:06 +0200, "Maarten Wiltink"
<maarten@xxxxxxxxxxxxxxxxxx> wrote:

>"Dr John Stockton" <jrs@xxxxxxxxxxxxxxxxxx> wrote in message
>news:equb2pIzkhYDFwme@xxxxxxxxxxxxxxxxxxxxx
>[...]
>> For some string types, length(s) is expensive, and should be done at
>> most once in the routine; at least in Pascal, it can be done at compile
>> time.

>Shortstring has the length as the byte at offset 0, ansistring as the
>dword at offset -4 or -8, I'm not sure which and it doesn't matter much.
>But in Delphi, Length() is not an expensive function unless you go out
>of your way to pass it a PChar.

AnsiString length is in the 4 bytes immediately preceeding the String
Data

The PChar stuff is not really that expensive unless the compiler
thinks that you are trying to mess around with a variable passed in as
a Const .. but I might have misunderstood there.

I must confess, I'm not that worried about the overhead of Length,
when one wants to optimize there are far more interesing and fecund
things to look at.


.