[DUG] Is it a bug in latest version of Delphi?
Kyley Harris
Kyley at harrissoftware.com
Tue Feb 16 15:02:25 NZDT 2010
Yes thats true. they could rewrite the VCL code to cater for that issue.
Cant say I've ever actually encountered this problem before.
normally if I am binding anything in a list box, then I am binding a real
pointer to some other object that might contain an integer property.. I dont
think I've ever used it to store an integer that was not a real pointer.
On Tue, Feb 16, 2010 at 2:54 PM, Jeremy North <jeremy.north at gmail.com>wrote:
> True, but as Joylon correctly points out, you can (in the VCL)
> actually cater for the difference in a "real" index out of bounds
> error and a LongInt(TObject) typecase returning -1.
>
> It's a bug and should be logged on QC, if it isn't there already.
>
> On Tue, Feb 16, 2010 at 12:50 PM, Kyley Harris <Kyley at harrissoftware.com>
> wrote:
> > 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
> >
> > _______________________________________________
> > 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
> >
>
> _______________________________________________
> 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/00a98561/attachment.html
More information about the Delphi
mailing list