[DUG] Is it a bug in latest version of Delphi?

Kyley Harris Kyley at harrissoftware.com
Tue Feb 16 14:50:42 NZDT 2010


interesting

>    if Longint(Result) = LB_ERR then Error(SListIndexError, Index);

it would seem that the error is not in delphi at all. Well.. they are simply
raising the Windows error which say that -1 is the error result for a bad
index access from windows. if delphi were to ignore this error and you asked
for the value at index[99] which was out of bounds and you got -1 instead of
an error I think there would be the same number of complaints from the other
side.

Clearly its the windows API that considers -1 invalid.. not delphi.

On Tue, Feb 16, 2010 at 2:24 PM, Karl Reynolds <kreynolds at chocfishsoft.co.nz
> wrote:

> On Tue, Feb 16, 2010 at 1:55 PM, Alister Christie
> <alister at salespartner.co.nz> wrote:
> > I think the point I was trying to make is that it is that the method
> > (/array indexer or whatever) was expecting a TObject - passing anything
> > else could result in unexpected results.
>
> Only if you stipulate that you have to remain ignorant of the function
> internals. The TObject is converted back and forth from a LongInt in
> order to store it anyway (see GetObject and PutObject).
>
> > The fact that -1 doesn't work
> > is therefor not a bug (unless you can have 1 byte sized objects).
>
> var x: longint;
>
> x := -1; // Four bytes
>
> (May the source be with you).
>
> Cheer,
> Karl
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>



-- 
Kyley Harris
Harris Software
+64-21-671-821
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100216/dedb48d2/attachment.html 


More information about the Delphi mailing list