From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4fb6ec6cd054de65 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-12 02:39:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!hub1.nntpserver.com!btnet-peer0!btnet-peer1!btnet!isdnet!enst!enst.fr!not-for-mail From: Christoph Grein Newsgroups: comp.lang.ada Subject: Re: constrained subtypes Date: Tue, 12 Mar 2002 11:37:49 +0100 (MET) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1015929542 30320 137.194.161.2 (12 Mar 2002 10:39:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 12 Mar 2002 10:39:02 +0000 (UTC) Return-Path: Content-MD5: +daWAKpKf9bkFlbtgHnJGA== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: Christoph Grein List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:21101 Date: 2002-03-12T11:37:49+01:00 subtype S is Integer range 1 .. 4; V : S begin case V is when 1 => [statement] when 2 .. 3 => [statement] when 4 => [statement] end case; case (V) is -- (V) is an expression of type Integer when 1 => [statement] when 2 .. 3 => [statement] when 4 => [statement] when others => -- needed [statement] end case; > Problem seemed to be in using: > > case (constrained_subtype) > > rather than: > > case constrained_subtype > > Removing the brackets sorted the problem. Not sure why this is a problem > for constrained subtypes, as the compilers cope fine for enums and (base) > integers. > > Sorry I didn't put the original code in my post, but was away from my build > machine, so was relying on my memory. Thanks for all reponses. > > > "George Stevens" wrote in message > news:3c8cc63b$1@pull.gecm.com... > > 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? > > > > > > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada