Re: type and subtype
- From: Jeffrey Carter <spam@xxxxxxxx>
- Date: Mon, 25 Jul 2005 08:41:48 -0700
Dmitry A. Kazakov wrote:
I think that Ludovic's view is more consistent: checks are just a part of the conversion which otherwise is an identity function, because *presently* the representation is required to be same. But representation is an implementation detail and thus cannot count. Moreover it is very desirable to allow subtypes having different representations.
Try this with your favorite compiler:
Ada.Text_IO.Put_Line (Item => "Integer'Size =" & Integer'Image (Integer'Size) ): Ada.Text_IO.Put_Line (Item => "Natural'Size =" & Integer'Image (Natural'Size) ):
You're likely to get something like
Integer'Size = 32 Natural'Size = 31
because representations of subtypes are not required to be the same.
We can also consider
type Rec (Length : Positive) is record V : String (1 .. Length); end record;
subtype Small is Rec (Length => 1); subtype Big is Rec (length => 1_000);
where Small and Big have significantly different representations. Then there are subtypes of variant record types with discriminants that select different variants.
begin:vcard fn:Jeffrey Carter n:;Jeffrey Carter email;internet:jeffrey_r_carter-nr [commercial-at] raytheon [period | full stop] com x-mozilla-html:FALSE version:2.1 end:vcard
- Follow-Ups:
- Re: type and subtype
- From: Dmitry A. Kazakov
- Re: type and subtype
- From: Ludovic Brenta
- Re: type and subtype
- References:
- type and subtype
- From: Douglas Chong
- Re: type and subtype
- From: Ludovic Brenta
- Re: type and subtype
- From: Jeffrey Carter
- Re: type and subtype
- From: Dmitry A. Kazakov
- type and subtype
- Prev by Date: Help needed for ada package
- Next by Date: Re: Isn't this in favour of Ada??
- Previous by thread: Re: type and subtype
- Next by thread: Re: type and subtype
- Index(es):
Relevant Pages
|