comp.lang.ada
 help / color / mirror / Atom feed
From: Mats.Weber@matrix.ch (Mats Weber)
Subject: Re: Need help with DEC Ada
Date: Mon, 23 Jan 1995 16:22:43 GMT
Date: 1995-01-23T16:22:43+00:00	[thread overview]
Message-ID: <Mats.Weber-2301951722430001@mlma11.matrix.ch> (raw)
In-Reply-To: 3fnhbe$4lq@gnat.cs.nyu.edu

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.



  reply	other threads:[~1995-01-23 16:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-01-17 21:01 Need help with DEC Ada Phil Dennis
1995-01-18 18:23 ` Mats Weber
1995-01-20  5:22   ` Robert Dewar
1995-01-23 16:22     ` Mats Weber [this message]
1995-01-19 19:38 ` Robert I. Eachus
replies disabled

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