Yes thats true. they could rewrite the VCL code to cater for that issue. Cant say I've ever actually encountered this problem before. <div><br></div><div>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.<br>
<br><div class="gmail_quote">On Tue, Feb 16, 2010 at 2:54 PM, Jeremy North <span dir="ltr"><<a href="mailto:jeremy.north@gmail.com">jeremy.north@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
True, but as Joylon correctly points out, you can (in the VCL)<br>
actually cater for the difference in a "real" index out of bounds<br>
error and a LongInt(TObject) typecase returning -1.<br>
<br>
It's a bug and should be logged on QC, if it isn't there already.<br>
<div><div></div><div class="h5"><br>
On Tue, Feb 16, 2010 at 12:50 PM, Kyley Harris <<a href="mailto:Kyley@harrissoftware.com">Kyley@harrissoftware.com</a>> wrote:<br>
> interesting<br>
>> if Longint(Result) = LB_ERR then Error(SListIndexError, Index);<br>
> it would seem that the error is not in delphi at all. Well.. they are simply<br>
> raising the Windows error which say that -1 is the error result for a bad<br>
> index access from windows. if delphi were to ignore this error and you asked<br>
> for the value at index[99] which was out of bounds and you got -1 instead of<br>
> an error I think there would be the same number of complaints from the other<br>
> side.<br>
> Clearly its the windows API that considers -1 invalid.. not delphi.<br>
><br>
> On Tue, Feb 16, 2010 at 2:24 PM, Karl Reynolds<br>
> <<a href="mailto:kreynolds@chocfishsoft.co.nz">kreynolds@chocfishsoft.co.nz</a>> wrote:<br>
>><br>
>> On Tue, Feb 16, 2010 at 1:55 PM, Alister Christie<br>
>> <<a href="mailto:alister@salespartner.co.nz">alister@salespartner.co.nz</a>> wrote:<br>
>> > I think the point I was trying to make is that it is that the method<br>
>> > (/array indexer or whatever) was expecting a TObject - passing anything<br>
>> > else could result in unexpected results.<br>
>><br>
>> Only if you stipulate that you have to remain ignorant of the function<br>
>> internals. The TObject is converted back and forth from a LongInt in<br>
>> order to store it anyway (see GetObject and PutObject).<br>
>><br>
>> > The fact that -1 doesn't work<br>
>> > is therefor not a bug (unless you can have 1 byte sized objects).<br>
>><br>
>> var x: longint;<br>
>><br>
>> x := -1; // Four bytes<br>
>><br>
>> (May the source be with you).<br>
>><br>
>> Cheer,<br>
>> Karl<br>
>> _______________________________________________<br>
>> NZ Borland Developers Group - Delphi mailing list<br>
>> Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
>> Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
>> Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject:<br>
>> unsubscribe<br>
><br>
><br>
><br>
> --<br>
> Kyley Harris<br>
> Harris Software<br>
> +64-21-671-821<br>
><br>
> _______________________________________________<br>
> NZ Borland Developers Group - Delphi mailing list<br>
> Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
> Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
> Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject:<br>
> unsubscribe<br>
><br>
<br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Kyley Harris<br>Harris Software<br>+64-21-671-821<br>
</div>