comp.lang.ada
 help / color / mirror / Atom feed
* static subtypes
@ 1983-11-04 23:52 greg
  0 siblings, 0 replies; only message in thread
From: greg @ 1983-11-04 23:52 UTC (permalink / raw)


It has been noted, and raised as an issue in this news group that an
in integer type declaration:

	type T is range L..R;  -- where L and R must be static

The type T is *not* a static range.
This comes about because in LRM 3.5.4 an integer type declaration is
defined as being equivalent to the following pair of declarations:

	type integer_type is new predefined_integer_type;

	subtype T is integer_type range integer_type(L)..integer_type(R);

Explicit type conversions are not static, thus the subtype T above is
not a static subtype.

Compare this with the derived type declaration:

	type T is new INTEGER range L..R;   --  where L and R are static.

Here, the derived subtype T is a static subtype because from LRM 3.4(3):

	"If a constraint exists for the parent subtype, a similar constraint
	 exists for the derived subtype; the only difference is that for a
	 range constraint, and likewise for a floating or fixed point
	 constraint that includes a range constraint, the value of each
	 bound is replaced by the corresponding value of the derived type"
		  -----------------------------------

Thus, no conversions are required or implied.

Is this difference between integer type definitions and derived type
definitions intended?

	Greg Burns, Verdix Corporation

	gburns.oregon-grad@csnet-relay
	{tektronix!ogcvax allegra!ogcvax inteloa decwrl!sequent}!verdix!greg

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1983-11-04 23:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1983-11-04 23:52 static subtypes greg

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