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

Edward Koryagin ed_iv2001 at yahoo.co.nz
Tue Feb 16 10:16:30 NZDT 2010


Yes, this is Delphi 'internal feature' ;)
You can use everything except -1.

Edward Koryagin

--- On Tue, 16/2/10, sinu sudhakaran <sinusudhakaran at rediffmail.com> wrote:

From: sinu sudhakaran <sinusudhakaran at rediffmail.com>
Subject: [DUG]  Is it a bug in latest versions of Delphi?
To: delphi at delphi.org.nz
Cc: John.Hansen at wizbang.co.nz, Delio.Azevedo at wizbang.co.nz, Richard.Crowle at wizbang.co.nz, James.Stainton at wizbang.co.nz
Received: Tuesday, 16 February, 2010, 9:25 AM

Hi all,



I came across a strange bug(???) in latest versions of Delphi.



Have a look at the following code.



procedure TForm1.Button1Click(Sender: TObject);

var

i : integer;

begin

ComboBox1.Clear;

ComboBox1.Items.AddObject('All Locations', TObject(-1));

ComboBox1.Items.AddObject('Only this Location', TObject(0));

ComboBox1.Items.AddObject(Test Location', TObject(1));



i := Integer(ComboBox1.Items.Objects[0]);

showmessage(inttostr(i));

end;



When I tried to run this code in Delphi 6 and Delphi 2007 , I am getting List Index out of bounds[0] error in Showmessage. When I tried -2, -3, -4… instead of -1 object , I got the proper output without any 

List index out of bounds error. Also I am getting -1 without any error when I tried this code in Delphi 3. 



Is it a bug in latest version of Delphi ? Any help is appreciated.



Thank you



Regards,

Sinu



-----Inline Attachment Follows-----

_______________________________________________
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


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100215/ab98e020/attachment-0001.html 


More information about the Delphi mailing list