comp.lang.ada
 help / color / mirror / Atom feed
From: "W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM>
Subject: Re: Integer'Size < 32 ?
Date: 1996/08/08
Date: 1996-08-08T00:00:00+00:00	[thread overview]
Message-ID: <9608081258.AA02749@most> (raw)


There have been many good answers to the two questions about 16 bit
integers (IMHO Dewar's was the clearest) but none of them mentioned
one detail:

One of the queries suggested that constraint_error would be raised
if the compiler did not have a big enough predefined integer type.

The truth is, if such a type is not supported, the compiler is supposed
to refuse to compile the program.

But I have a related question: many of the posts on the topic repeated
the definition

   .... range -(2**31) .. ((2**31)-1)

I once used a compiler for which Integer'Size = 32 and which had an
interesting "feature."  It recognized that the above would fit in 32 bits,
so it compiled for that size.  Then at run-time, it would (obeying
the precedence rules) try to compute 2**31 and raise constraint_error.
(I didn't use the parentheses, but that doesn't change the semantics.)
The ugly work-around was

   .... range  -2**31 .. 2**30 + (2**30 - 1);

My question is, "Is this a common 'feature'?"  (Since so many people have
quoted the same example, I presume the answer is 'no')

--
---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Hughes Defense Communications (MS 10-40)                 Home: 219-471-7206
Fort Wayne,  IN   46808                  (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




             reply	other threads:[~1996-08-08  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-08  0:00 W. Wesley Groleau (Wes) [this message]
1996-08-09  0:00 ` Integer'Size < 32 ? Robert A Duff
1996-08-10  0:00 ` Robert Dewar
1996-08-11  0:00 ` Mark A Biggar
1996-08-12  0:00   ` Robert Dewar
replies disabled

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