comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <dewar@gnat.com>
Subject: Re: Representation clause for enumeratives
Date: Sat, 10 Feb 2001 06:19:17 GMT
Date: 2001-02-10T06:19:17+00:00	[thread overview]
Message-ID: <962mh2$f9v$1@nnrp1.deja.com> (raw)
In-Reply-To: Ndyg6.1048$y03.96769@news.flash.net

In article <Ndyg6.1048$y03.96769@news.flash.net>,
  "Ken Garlington" <Ken.Garlington@computer.org> wrote:
> I don't know if either behavior is considered "wrong" by the
standard. I'm
> not comfortable with the GNAT behavior, since it treats
16#8000_0000# as a
> legal 32-bit integer value, although it is not in the range
Standard.Integer
> on the same machine.

Who says that the range of enumeration values is restricted
to Standard.Integer, in fact no one says it, and the RH in
the RM encourages you to go up to maxint which for GNAT
is 2**63-1. Why you should be uncomfortable because GNAT
does NOT implement a limitation which

(a) would not be helpful
(b) would violate implementation advice

is puzzling indeed!

> This just encourages the confusion between hex numbers
> and bit-patterns. I do see the utility of doing it this way,
> however.

I don't understand the confusion. GNAT chooses a large enough
signed or unsigned integer type to cover the range of values
provided.

Note that 16#8000_0000# is the number 2**32, it is a POSITIVE
number, nothing at all to do with the largest negative number.
I think the confusion is coming from the use of base 16, and
suddenly that is translating into bit patterns in your mind???

Any time you write 16#8000_0000# in your program, you could
equally well write 2147483648. The meaning is 100% identical.
If the first looks like a bit pattern to you, and the second
looks like an integer, then that's your confusion, not Ada's
:-)


Sent via Deja.com
http://www.deja.com/



  parent reply	other threads:[~2001-02-10  6:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-08  9:53 Representation clause for enumeratives Sandro Binetti
2001-02-08 10:12 ` Tarjei T. Jensen
     [not found]   ` <95u470$ho1$1@nnrp1.deja.com>
     [not found]     ` <95ua6q$mp4$1@nnrp1.deja.com>
2001-02-08 15:41       ` M. Kotiaho
2001-02-08 16:27         ` Steve O'Neill
2001-02-09  7:26           ` Sandro Binetti
2001-02-09  9:29           ` Martin Dowie
2001-02-08 15:55     ` Marin David Condic
2001-02-08 16:22 ` Rod Chapman
2001-02-10  6:34   ` Robert Dewar
2001-02-12 11:32     ` Rod Chapman
2001-02-08 18:52 ` Greg Bek
     [not found] ` <Ndyg6.1048$y03.96769@news.flash.net>
2001-02-09  5:02   ` Ken Garlington
2001-02-10  6:29     ` Robert Dewar
2001-02-10 16:37       ` Ken Garlington
2001-02-10 17:29         ` Robert Dewar
2001-02-11  1:09           ` Ken Garlington
2001-02-11  5:27             ` Robert Dewar
2001-02-11 12:53               ` Laurent Guerby
2001-02-12  0:24                 ` Robert Dewar
2001-02-12 20:10                   ` Laurent Guerby
2001-02-11 14:50               ` Ken Garlington
2001-02-10 17:31         ` Robert Dewar
2001-02-11  1:09           ` Ken Garlington
2001-02-11  5:28             ` Robert Dewar
2001-02-11 14:50               ` Ken Garlington
2001-02-12  0:30                 ` Robert Dewar
2001-02-12  2:34                   ` Ken Garlington
2001-02-10  6:19   ` Robert Dewar [this message]
2001-02-10 11:42     ` David C. Hoos, Sr.
2001-02-10 16:37     ` Ken Garlington
     [not found] ` <3A829EB8.A098925E@baesystems.com>
     [not found]   ` <95uae3$n5j$1@nnrp1.deja.com>
2001-02-12  9:12     ` Stuart Palin
replies disabled

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