On Tue, 2006-02-21 at 14:34 -0500, Robert Dewar wrote: > Jeffrey A Law wrote: > > > So, if we have an object with the range based on its type of > > [0, 0x7fffffff] and we add 1 to that object, the resulting range > > should be [1, 0x7fffffff]. ie, 0x80000000 is not a valid value > > for the type. Right? > > The actual rule in Ada works like this: > > type X is range 0 .. 16#7fff_ffff#; > > Y : X; > > Y := (Y + 1) - 1; > > If Y is X'Last, then the addition of 1 must either raise an > overflow exception or "work". Works means give its proper > mathematical value. > > So this assignment can either raise CE, or leave Y unchanged. > Either is OK. So in the case above, the set of permissible values is [1, 0x7fffffff] after the addition, right? It's also valid to raise a CE.
Jeff