comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <jacob@jacob-sparre.dk>
Subject: Re: In mode parameter in an assignment statement
Date: Sat, 13 Oct 2018 07:52:51 +0200
Date: 2018-10-13T07:52:51+02:00	[thread overview]
Message-ID: <87sh1as898.fsf@jacob-sparre.dk> (raw)
In-Reply-To: 82fdea5d-b9b6-4f1e-a45f-ee0ff9f55946@googlegroups.com

Anh Vo <anhvofrcaus@gmail.com> writes:

>    -- ...
>
>    ------------------
>    -- 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.

Probably that there is an access type involved.

If "Mapped_Region" is an access type, then "Region.Data" could be a
short-hand for "Region.all.Data".

Greetings,

Jacob
-- 
"I've got _plenty_ of common sense!"
"I just choose to ignore it."


  reply	other threads:[~2018-10-13  5:52 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 [this message]
2018-10-13  6:03 ` Per Sandberg
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