comp.lang.ada
 help / color / mirror / Atom feed
From: stt@ada-uts
Subject: Re: Why one TYPE instead of the other?
Date: Fri, 2-Oct-87 16:33:00 EDT	[thread overview]
Date: Fri Oct  2 16:33:00 1987
Message-ID: <57900046@ada-uts> (raw)
In-Reply-To: 23613@ucbvax.Berkeley.EDU


The first form selects an underlying implementation
based on the range, which must be specified via *static*
expressions.   This form may fail at compile-time if
the requested range cannot be supported by any predefined
type.

The second form specifies that predefined INTEGER
be used as the underlying implementation type,
and the range may be specified by arbitrary, potentially
run-time, INTEGER expressions.
This form will never fail at compile-time, but
may raise Constraint_Error at run-time if the range you
specify is outside of Integer'FIRST .. Integer'LAST.

Based on the above characteristics, the first form
is preferable when legal, since it is not dependent
on the relative sizes of the various predefined integer types,
and detects out-of-range problems at compile-time.

But as noted, it cannot be used if the desired bounds
are not static (which implies compile-time-known) expressions.

S. Tucker Taft
Intermetrics, Inc.
Cambridge, MASS

       reply	other threads:[~1987-10-02 20:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <23613@ucbvax.Berkeley.EDU>
1987-10-02 20:33 ` stt [this message]
1987-09-25 13:16 Why one TYPE instead of the other? Freeman Moore - 575-3507
replies disabled

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