comp.lang.ada
 help / color / mirror / Atom feed
From: joakimds@kth.se
Subject: Re: Calling a record type's methods (functions or procedure) when record is in an array
Date: Thu, 23 Jan 2020 07:02:21 -0800 (PST)
Date: 2020-01-23T07:02:21-08:00	[thread overview]
Message-ID: <c54a537d-4ac1-417e-9f25-47f450b79d4f@googlegroups.com> (raw)
In-Reply-To: <e073de39-42bf-4571-aaaf-c7107d9f6962@googlegroups.com>

Obvious copy paste error:

   function Allocate_Car return Any_Car is
      Default : constant Any_Car
        := (Offset           => Taft_Car'Max_Size_In_Storage_Elements,
            Allocated_Memory => (others => 0),
            Reference        => null);
   begin
      return Car : Any_Car (Taft_Car'Max_Size_In_Storage_Elements) do
         declare
            First_Index : constant System.Storage_Elements.Storage_Offset
              := Car.Allocated_Memory'First;
         begin
            Car.Reference := Conversions.To_Pointer
              (Car.Allocated_Memory (First_Index)'Address).all'Access;
         end;
      end return;
   end Allocate_Car;

should be:

   function Allocate_Car return Any_Car is
   begin
      return Car : Any_Car (Taft_Car'Max_Size_In_Storage_Elements) do
         declare
            First_Index : constant System.Storage_Elements.Storage_Offset
              := Car.Allocated_Memory'First;
         begin
            Car.Reference := Conversions.To_Pointer
              (Car.Allocated_Memory (First_Index)'Address).all'Access;
         end;
      end return;
   end Allocate_Car; 

Other issues?

Best regards,
Joakim

  reply	other threads:[~2020-01-23 15:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17 23:30 Calling a record type's methods (functions or procedure) when record is in an array Mace Ayres
2020-01-18 12:31 ` Simon Wright
2020-01-18 18:02 ` Mace Ayres
2020-01-18 20:53   ` Simon Wright
2020-01-21 20:51   ` Shark8
2020-01-21 23:17     ` Jeffrey R. Carter
2020-01-23 15:00     ` joakimds
2020-01-23 15:02       ` joakimds [this message]
2020-01-23 16:51         ` Simon Wright
2020-01-24  9:47           ` joakimds
2020-01-23 20:15       ` Optikos
2020-01-19 15:06 ` Mace Ayres
replies disabled

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