[fpc-pascal] AnsiStrLComp AnsiStrLIComp
Mattias Gaertner
nc-gaertnma at netcologne.de
Mon Dec 8 17:56:08 CET 2014
On Mon, 8 Dec 2014 17:36:43 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:
>[...]
> > Michael, can you add a comment to this example, that runs beyond the
> > strings:
> > Testit('One string','One smaller string',255);
>
> ? There is no #0 character. So what does this example prove ?
I'm not sure if every reader knows why this example works.
The number should be lower or equal the length of the
shortest string to avoid running out of bounds.
The 255 looks as if it is ok to pass a number bigger
than the length of the strings.
For example this creates an AV on x86_64:
AnsiStrLIComp('A','B',1000000);
Mattias
More information about the fpc-pascal
mailing list