comp.lang.ada
 help / color / mirror / Atom feed
* Unchecked_Conversion and task pointer.
@ 2005-07-07 15:50 e.coli
  2005-07-07 18:56 ` Randy Brukardt
  2005-07-07 20:18 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 13+ messages in thread
From: e.coli @ 2005-07-07 15:50 UTC (permalink / raw)


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




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-07-13  8:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-07 15:50 Unchecked_Conversion and task pointer e.coli
2005-07-07 18:56 ` Randy Brukardt
2005-07-07 21:39   ` e.coli
2005-07-09  6:23     ` Simon Wright
2005-07-07 20:18 ` Dmitry A. Kazakov
2005-07-07 21:31   ` Randy Brukardt
2005-07-08  7:48     ` Dmitry A. Kazakov
2005-07-10  1:42       ` Randy Brukardt
2005-07-10  8:26         ` Dmitry A. Kazakov
2005-07-11 18:28           ` Randy Brukardt
2005-07-12  8:13             ` Dmitry A. Kazakov
2005-07-12 20:30               ` Randy Brukardt
2005-07-13  8:11                 ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox