comp.lang.ada
 help / color / mirror / Atom feed
From: DrPi <314@drpi.fr>
Subject: Re: renames usage
Date: Sat, 2 Jan 2021 12:53:18 +0100	[thread overview]
Message-ID: <5ff05eaf$0$16182$426a74cc@news.free.fr> (raw)
In-Reply-To: <rsn7i4$1nak$1@gioia.aioe.org>

Le 01/01/2021 à 14:20, Dmitry A. Kazakov a écrit :
> On 2021-01-01 13:39, DrPi wrote:
> 
>> Reading all the answers, I understand that :
>>      X : Float renames Random (Seed);
>> is equivalent to :
>>      X : constant Float := Random (Seed);
>>
>> Right ?
> 
> You must keep in mind that renaming ignores subtype contraints. So:
> 
>     X : Integer := -1;
>     Y : Positive renames X; -- Let's fool ourselves
> begin
>     Put_Line ("A positive number " & Integer'Image (Y));
> 
> Will happily print "A positive number -1."
> 
Interresting.
Thanks.

  reply	other threads:[~2021-01-02 11:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 11:48 renames usage DrPi
2020-12-31 12:10 ` John Perry
2020-12-31 13:31   ` DrPi
2020-12-31 12:33 ` Gautier write-only address
2020-12-31 14:49 ` Jeffrey R. Carter
2020-12-31 15:55   ` DrPi
2020-12-31 18:48     ` Dmitry A. Kazakov
2021-01-01 12:39       ` DrPi
2021-01-01 13:20         ` Dmitry A. Kazakov
2021-01-02 11:53           ` DrPi [this message]
2021-01-01 14:46         ` Jeffrey R. Carter
2021-01-02 11:55           ` DrPi
2021-01-03  3:19           ` Randy Brukardt
2021-01-03 10:05             ` Jeffrey R. Carter
2021-01-06  2:49               ` Randy Brukardt
2021-01-02 16:00         ` G.B.
2021-01-02 17:22           ` Simon Wright
replies disabled

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