comp.lang.ada
 help / color / mirror / Atom feed
* Re: Integer'Size < 32 ?
@ 1996-08-08  0:00 W. Wesley Groleau (Wes)
  1996-08-09  0:00 ` Robert A Duff
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: W. Wesley Groleau (Wes) @ 1996-08-08  0:00 UTC (permalink / 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
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1996-08-12  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-08  0:00 Integer'Size < 32 ? W. Wesley Groleau (Wes)
1996-08-09  0:00 ` 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

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