Re: unsigned type



On 12 Jul., 19:57, Samuel Tardieu <s...@xxxxxxxxxxx> wrote:
"anon" == anon  <a...@xxxxxxxx> writes:

anon> But some here and the GNAT compiler says the ( 1 .. 0 ) and ( -5
anon> .. -7 ) are both valid in the source code.  A string with the
anon> range of ( -5 .. -7 ) looks like bad C coding anfd that's not Ada.

The RM says that explicitely:

RM 3.5 (4): "A range has a lower bound and an upper bound and specifies
a subset of the values of some scalar type (the type of the range). A
range with lower bound L and upper bound R is described by ``L
.. R''. If R is less than L, then the range is a null range, and
specifies an empty set of values. Otherwise, the range specifies the
values of the type from the lower bound to the upper bound, inclusive."

RM 3.5 (8): "A range is compatible with a scalar subtype if and only if
it is either a null range or each bound of the range belongs to the
range of the subtype. A range_constraint is compatible with a scalar
subtype if and only if its range is compatible with the subtype."

So 1 .. 0 or -5 .. -7 are null ranges, thus compatible with a Positive
range.

  Sam
--
Samuel Tardieu -- s...@xxxxxxxxxxx --http://www.rfc1149.net/

My dear Sam, this is Love's Labour's Lost because this has been
pointed out to anon several times in this discussion - he just won't
listen.
.



Relevant Pages

  • Re: unsigned type
    ... "A range has a lower bound and an upper bound and specifies ... a subset of the values of some scalar type. ... range of the subtype. ...
    (comp.lang.ada)
  • Re: Releated to POSETS (Partially ordered sets).
    ... could you tell me the lower bound and the upper bound in this ... The upper and lower bound of WHAT, ... You are missing one upper bound. ... --- Calvin ...
    (sci.math)
  • Re: unbounded
    ... How can g be unbounded when it has a lower bound of 0? ... Why is h unbounded when it has an upper bound of 0? ... QxQ is unbounded in every rational direction ...
    (sci.math)
  • Re: unbounded
    ... How can g be unbounded when it has a lower bound of 0? ... Why is h unbounded when it has an upper bound of 0? ... distinctly different notions of unbounded? ... The negation of bounded is unbounded above or unbounded below. ...
    (sci.math)
  • Re: unbounded
    ... How can g be unbounded when it has a lower bound of 0? ... Why is h unbounded when it has an upper bound of 0? ... The negation of bounded is unbounded above or unbounded below. ... What's common usage distinguishing not bounded and unbounded? ...
    (sci.math)