This is the mail archive of the
mailing list for the GCC project.
Re: Ada subtypes and base types
- From: Robert Dewar <dewar at adacore dot com>
- To: Laurent GUERBY <laurent at guerby dot net>
- Cc: law at redhat dot com, Waldek Hebisch <hebisch at math dot uni dot wroc dot pl>, gcc at gcc dot gnu dot org
- Date: Wed, 15 Mar 2006 23:09:56 -0500
- Subject: Re: Ada subtypes and base types
- References: <E1FDnj3firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
Laurent GUERBY wrote:
On Mon, 2006-03-13 at 15:31 -0700, Jeffrey A Law wrote:
On Mon, 2006-02-27 at 20:08 +0100, Waldek Hebisch wrote:
What do you mean by "abuse"? TYPE_MAX_VALUE means maximal value
allowed by given type.
As long as you're *absolutely* clear that a variable with a
restricted range can never hold a value outside that the
restricted range in a conforming program, then I'll back off
the "abuse" label and merely call it pointless :-)
Variables in a non erroneous Ada program all have their value between
their type bounds from the optimizer perspective (the special 'valid
case put aside).
Not quite right. If you have an uninitialized variable, the value is
invalid and may be out of bounds, but this is a bounded error situation,
not an erroneous program. So the possible effects are definitely NOT
unbounded, and the use of such values cannot turn a program erroneous.
(that's an Ada 95 change, this used to be erroneous in Ada 83).