From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: quiz for Sequential_IO Read
Date: Sun, 3 Sep 2017 15:44:53 +0200
Date: 2017-09-03T15:44:53+02:00 [thread overview]
Message-ID: <ooh0oc$e7e$1@dont-email.me> (raw)
In-Reply-To: <oogtlq$cbg$1@newsreader4.netcologne.de>
On 09/03/2017 02:47 PM, Frank Buss wrote:
>
> Why is it a signed type? The range says only 0..255, and in fact, I can write this:
>
> type Byte is range 0..255; for Byte'Size use 8;
>
> and it works as expected.
It's signed because the language definition says it's signed. All types declared
with range are signed. See ARM 3.5.4
http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-3-5-4.html
for the gory details.
If you don't specify 'Size, then the compiler uses the 'Size for the base type.
If you specify the size it will use that instead. Realistically, stand-alone
objects will always use complete bytes to store a value, and Sequential_IO will
read and write that number of bytes. So without a Size clause, Sequential_IO
read 2 bytes, and with it, only 1.
--
Jeff Carter
"Oh Lord, bless this thy hand grenade, that with it thou
mayst blow thine enemies to tiny bits, in thy mercy."
Monty Python and the Holy Grail
24
next prev parent reply other threads:[~2017-09-03 13:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-03 11:01 quiz for Sequential_IO Read Frank Buss
2017-09-03 11:40 ` Jeffrey R. Carter
2017-09-03 12:47 ` Frank Buss
2017-09-03 13:44 ` Jeffrey R. Carter [this message]
2017-09-03 15:38 ` AdaMagica
2017-09-03 12:26 ` Dmitry A. Kazakov
2017-09-03 12:43 ` Frank Buss
2017-09-03 13:11 ` Dmitry A. Kazakov
2017-09-04 19:58 ` Frank Buss
2017-09-04 20:55 ` Dmitry A. Kazakov
2017-09-04 21:51 ` Frank Buss
2017-09-05 1:54 ` Dennis Lee Bieber
2017-09-03 17:28 ` J-P. Rosen
2017-09-03 20:10 ` Frank Buss
2017-09-04 5:12 ` J-P. Rosen
2017-09-04 7:37 ` Dmitry A. Kazakov
2017-09-03 20:17 ` Dennis Lee Bieber
2017-09-04 5:14 ` J-P. Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox