Unchecked_Conversion and task pointer.
- From: "e.coli" <maurizio.ferracini@xxxxxxxxx>
- Date: 7 Jul 2005 08:50:55 -0700
look at this exemple:
----------------------------------------------------
with Ada.Unchecked_Conversion;
with Ada.Text_Io;
procedure Main is
task type Cain is
entry Who_Are_You;
end Cain;
task type Abel is
entry Who_Are_You;
end Abel;
type Ptr_Cain is access Cain;
type Ptr_Abel is access Abel;
task body Cain is
begin
loop
accept Who_Are_You;
Ada.Text_Io.Put_Line(Item => "I'm Cain");
end loop;
end Cain;
task body Abel is
begin
loop
accept Who_Are_You;
Ada.Text_Io.Put_Line(Item => "I'm Abel");
end loop;
end Abel;
function Mess_Up is
new Ada.Unchecked_Conversion
(
Source => Ptr_Cain,
Target => Ptr_Abel);
X : Ptr_Cain;
Y : Ptr_Abel;
begin
X:= new Cain;
Y:= new Abel;
X.Who_Are_You;
Y.Who_Are_You;
Y:=Mess_Up(X);
-- where are your brother?
X.Who_Are_You;
Y.Who_Are_You;
end Main;
------------------------------------------------
how work Unchecked_Conversion with task pointer?
the behavior depend by the compiler?
thaks
.
- Follow-Ups:
- Re: Unchecked_Conversion and task pointer.
- From: Dmitry A. Kazakov
- Re: Unchecked_Conversion and task pointer.
- From: Randy Brukardt
- Re: Unchecked_Conversion and task pointer.
- Prev by Date: Re: GCC 4.0 Ada.Containers Cursor danger.
- Next by Date: Private primitive operations available to entire package hierarchy. Can it be done?
- Previous by thread: WebControls with A#
- Next by thread: Re: Unchecked_Conversion and task pointer.
- Index(es):
Relevant Pages
|