comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jeffrey.carter@boeing.com>
Subject: Re: constrained subtypes
Date: Mon, 11 Mar 2002 16:50:40 GMT
Date: 2002-03-11T16:50:40+00:00	[thread overview]
Message-ID: <3C8CE060.5E003C0@boeing.com> (raw)
In-Reply-To: 3c8cc63b$1@pull.gecm.com

George Stevens wrote:
> 
> We're trying to use subtypes of base integer, constraining them 1 .. 8
> (i.e. static values)
> When we use these types in a case statement, covering values 1 - 8, the
> Aonix Ada compiler (7.1.2) complains that we haven't defined "others".
> However, we shouldn't need to, as all cases are within the constrained
> limits.  I've looked at Programming in Ada 95 - Barnes (p106) which seems to
> suggest that we're doing the right thing language-wise, so long as the range
> limits are static types.
> 
> Is this a compiler funny or an Ada funny?

Without seeing your code, I can't say. The ARM says

The possible values of the expression shall be covered as follows: 

       * If the expression is a name (including a type_conversion or a
function_call) having a static and constrained nominal subtype, or is a
         qualified_expression whose subtype_mark denotes a static and
constrained scalar subtype, then each non-others discrete_choice
         shall cover only values in that subtype, and each value of that
subtype shall be covered by some discrete_choice (either explicitly or
by
         others). 

       * If the type of the expression is root_integer,
universal_integer, or a descendant of a formal scalar type, then the
case_statement shall
         have an others discrete_choice. 

       * Otherwise, each value of the base range of the type of the
expression shall be covered (either explicitly or by others).

If your case expression falls under the first bullet, then it's a
compiler bug. If it falls under the other 2 bullets, though, it is an
error in your understanding.

From the compiler message information you've provided, it sounds as if
the compiler thinks your expression falls under the second bullet
(others choice required).

-- 
Jeffrey Carter



  parent reply	other threads:[~2002-03-11 16:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-11 15:00 constrained subtypes George Stevens
2002-03-11 16:16 ` Stephen Leake
2002-03-11 16:50 ` Jeffrey Carter [this message]
2002-03-11 21:05 ` Anh_Vo
2002-03-12  9:39 ` George Stevens
2002-03-12 10:38   ` Martin Dowie
2002-03-12 11:57     ` George Stevens
2002-03-12 12:02       ` Martin Dowie
2002-03-12 12:03       ` Martin Dowie
2002-03-12 16:42   ` Jeffrey Carter
2002-03-13 22:09 ` Wannabe h4x0r
  -- strict thread matches above, loose matches on Subject: below --
2002-03-12  7:59 Christoph Grein
2002-03-12 10:37 Christoph Grein
2002-03-13  6:22 Christoph Grein
2002-03-13 14:18 ` Robert Dewar
2002-03-14 11:01 Christoph Grein
replies disabled

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