This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ada subtypes and base types


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]