Thread View: comp.lang.pascal.delphi.components.usage
1 messages
1 total messages
Started by Dominik L�bbers
Wed, 03 Feb 1999 00:00
Type conversion while debugging
Author: Dominik L�bbers
Date: Wed, 03 Feb 1999 00:00
Date: Wed, 03 Feb 1999 00:00
41 lines
1998 bytes
1998 bytes
Since a few weeks I use Delphi 4 (German, Update Pack #2).
I noticed a strange behaviour while debugging the following code:
{$OPTIMIZATION OFF}
procedure TForm1.Button2Click(Sender: TObject);
var
l: TList;
a: TAdresse;
p: Pointer;
begin
l := TList.Create;
try
a := TAdresse.Create('Smith', 'Washington');
l.add(a);
p := l[0];
finally
l.Free; /* set the breakpoint here */
end;
end;
When you run the program that contains this method and let it stop at
the
shown position, you can inspect the following expressions:
1) l[0]
2) TAdresse(l[0])
3) p
4) TAdresse(p)
Since p is given the value of l[0] both variables should behave in the
same way.
But they don't. l[0] is evaluated correctly and contains the same value
as p.
But while the type conversion of p to TAdresse is possible and shows
('Smith', 'Washington')
the debugger is not able to inspect the second expression
(TAdresse(l[0]).
Why is the same type conversion as in No. 4 impossible in this
situation?
Thanks for any help
Dominik Luebbers
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads