ik schrieb:
I think it's a Delphi bug to act like that. You must provide a length
that is not bigger in size. It's up to you the developer.
Otherwise you might have more then one type of buffer overflows in your code !
The way Delphi solved it, is by taking the responsibility from the
developer, and made the code a bit slower.
Delphi specified Copy as *not* requiring exact parameters. The length
always could be bigger than the string length, in which case the copy
stops at the end of the source string. Likewise the starting index can
be past the length of the source string, resulting in an empty string.
Performance is not affected, and the overall code size decreases, when
the user doesn't have to calculate and check everything, every time
before calling Copy. Please understand that even throwing an exception
requires an check before, so that it's only a simple decision whether to
fix an improper parameter value silently, or to throw an exception.
DoDi
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel