comp.lang.ada
 help / color / mirror / Atom feed
From: Per Sandberg <per.s.sandberg@bahnhof.se>
Subject: Re: In mode parameter in an assignment statement
Date: Sat, 13 Oct 2018 08:03:00 +0200
Date: 2018-10-13T08:03:00+02:00	[thread overview]
Message-ID: <pUfwD.16157$7P5.6379@fx19.fr7> (raw)
In-Reply-To: <82fdea5d-b9b6-4f1e-a45f-ee0ff9f55946@googlegroups.com>

package GNATCOLL.Mmap is
....
private
    type Mapped_Region_Record;
    type Mapped_Region is access Mapped_Region_Record;
...
end GNATCOLL.Mmap;

If you look in the spec you will see that Mapped_Region is an access 
type referencing the incomplete Mapped_Region_Record that is completed 
in the body, any yes the implicit deference makes it look a bit strange.
/P


On 10/13/18 2:48 AM, Anh Vo wrote:
>     -- ...
> 
>     ------------------
>     -- Compute_Data --
>     ------------------
> 
>     procedure Compute_Data (Region : Mapped_Region) is
>        Data_Shift : constant Storage_Offset :=
>           Storage_Offset (Region.User_Offset - Region.System_Offset);
>     begin
>        if Region.User_Size = 0 then
>           Region.Data := Empty_String'Address;
>        elsif Region.Mapped then
>           Region.Data := Region.Mapping.Address + Data_Shift;
>        else
>           Region.Data := Region.Buffer.all'Address + Data_Shift;
>        end if;
>     end Compute_Data;
> 
> end GNATCOLL.Mmap;
> 
> The above code is the tail end of package gnatcoll-mmap.adb.
> 
> I thought it should be rejected during compilation because in mode parameter is not allowed in an assignment statement. But, it was compiled successfully under GNAT obviously.
> 
> What did I miss? Thanks in advance.
> 
> Anh Vo
> 

  parent reply	other threads:[~2018-10-13  6:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13  0:48 In mode parameter in an assignment statement Anh Vo
2018-10-13  5:52 ` Jacob Sparre Andersen
2018-10-13  6:03 ` Per Sandberg [this message]
2018-10-13  8:38 ` Jeffrey R. Carter
2018-10-15 16:05   ` Anh Vo
replies disabled

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