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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9c0aeffddd5a8549 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-23 08:22:43 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!csn!magnus.acs.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!news.sprintlink.net!EU.net!chsun!mlma11.matrix.ch!user From: Mats.Weber@matrix.ch (Mats Weber) Subject: Re: Need help with DEC Ada Message-ID: Sender: usenet@eunet.ch Organization: ELCA Matrix SA References: <19950117.160119.606@vnet.ibm.com> <3fnhbe$4lq@gnat.cs.nyu.edu> Date: Mon, 23 Jan 1995 16:22:43 GMT Date: 1995-01-23T16:22:43+00:00 List-Id: In article <3fnhbe$4lq@gnat.cs.nyu.edu>, dewar@cs.nyu.edu (Robert Dewar) wrote: > Mats says: > > "the original (2**31)-1 should not cause any problem. Ae you really sure it > generates a warning ?" > > sorry Mats, that is wrong, in Ada 83, this expression was not a static > expression evaluated at compile time, and hence a compiler is allowed to > compute it at runtime, insisting that all intermediate values are in > range of the type (in this case a 32 bit integer). Right. But there is a workaround in Ada 83, using a named number: Upper : constant := (2**31)-1; type T is range 0 .. Upper; which forces the computation to be done in universal-integer.