Re: 'Base
- From: Martin Dowie <martin.dowie@xxxxxxxxxxxxxxx>
- Date: Thu, 8 Dec 2005 18:44:53 +0000 (UTC)
Matthew Heaney wrote:
[snip]T'Base refers to the "base range" of the type, which defines the range in which intermediate calculations are performed.
The standard states that the range of T'Base:
(1) includes the value 0 (2) is symmetric about zero, with possibly an extra negative value (3) includes all of the values in the subtype T
So for example, if T is:
type T is 1 .. 42;
then T'Base is
type T'Base is -42 .. 42;
I might have some of the details wrong, but that's the general idea.
Sorry Matt - you must be ill or something as you're a wee bit "off base" with your answer to this one!
Try this test prog to see what actually happens:
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Base is type T is range 1 .. 42; begin Put_Line (T'Base'Image (T'Base'First)); Put_Line (T'Base'Image (T'Base'Last)); end Test_Base;
It isn't -42 .. 42 but the 'First .. 'Last or the underlying integer representation. In this case (with ObjectAda) -2147483648 to 2147483647.
Cheers
-- Martin .
- Follow-Ups:
- Prev by Date: Gnat calls to Aonix DLL
- Next by Date: Re: 'Base
- Previous by thread: Re: 'Base
- Next by thread: Re: 'Base
- Index(es):
Relevant Pages
|