From: Robert A Duff <bobduff@world.std.com>
Subject: Re: OS Bindings (was: Where is the elusive jump command?)
Date: 2000/04/13
Date: 2000-04-13T00:00:00+00:00 [thread overview]
Message-ID: <wccem8aqdw0.fsf@world.std.com> (raw)
In-Reply-To: 8d457u$5n33@ftp.kvaerner.com
"Tarjei T. Jensen" <tarjei.jensen@kvaerner.com> writes:
> Robert A Duff wrote
> >Also because System.Max_Int is 2**63-1 or 2**31-1 on most
> >implementations, and there's a rule saying that the bounds have to be
> >less than or equal to System.Max_Int.
> >
> >If I made the rules, there would be no Max_Int.
>
> Then I change the declaration to
>
> type T is range 0 .. #16#ffff_ffff_ffff_ffff;
How about:
type T is range 0 .. 16#ffff_ffff_ffff_ffff#;
? ;-) Or, equivalently, ".. 2**64-1".
> If the compiler complains because the number is out of range for an integer if
> it otherwise supports 64 bit numbers I think the compiler has been poorly
> constructed.
Then *all* Ada compilers are poorly constructed. ;-) At least, all of
the Ada compilers I have seen have Max_Binary_Modulus = 2**N, and
Max_Int = 2**(N-1)-1, for some N (generally the word size, or twice the
word size, of the hardware). That's what the language designers
intended, too. So, if N = 32, then:
type Signed is range 0..2**32-1; -- Illegal!
type Modular is mod 2**32; -- Legal.
Type Signed is illegal on that implementation.
This means that you're *forced* to use modular when you want to count up
to 2**N-1, even though you don't want wrap-around arithmetic.
It also means that you're out of luck if you want to count up to 2**N or
more. And, unfortunately, N is not portable.
>... As long as the lower bound is 0 or positive then it is quite clear
> that it is a unsigned type. It seems pointless to involve max_int in this
> unless we are talking about a signed number.
But Max_Int is the *definition* of the largest (fully) supported
integer! It's fine to complain that Max_Int is too small, but I don't
think it makes sense to say Max_Int should be wrong.
> I don't care about the T base type. I think that the above definition is
> perfectly reasonable even though it may be contrary to the letter of the
> standard.
You *have* to care about the base subtype, because that determines the
range of intermediate expression results.
> I think it is a glaring oversight in the standard if it not only allows, but
> requires compilers to honour a definition like the one above.
I tend to agree. As I said in another note, I think there should be no
Max_Int. I think all Ada compilers should be required to support things
like:
type Huge is range -2**100..2**1000;
although, as Robert Dewar pointed out, I might not want to insist that
Huge be allowed as an array index type, for example.
An Ada implementation that restricted arrays to one or two words would
be a joke. I think that integers also should not be restricted to one
or two words.
>...I don't have the
> final version of the RM here, only the June 94 version.
This Max_Int stuff hasn't changed since Ada 83. Modular types are of
course new in Ada 95, and they changed a lot during the Ada 9X project.
There was a version where there was no new syntax for them; there was
just a package Unsigned (in the SP annex, I think), which declared a
bunch of magical integer types that behaved differently from other
integer types. I kind of liked that design, because it makes it clear
that the semantics of these types is a low-level machine-oriented hack.
You can get the real Ada 95 RM from somewhere in:
http://www.adaic.org/
and print out the postscript file.
- Bob
next prev parent reply other threads:[~2000-04-13 0:00 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-21 0:00 Where is the elusive jump command? dis90072
2000-03-21 0:00 ` Nicolas Brunot
2000-03-21 0:00 ` Stanley R. Allen
2000-03-21 0:00 ` Nicolas Brunot
2000-03-27 0:00 ` Robert A Duff
2000-03-28 0:00 ` Dale Stanbrough
2000-03-28 0:00 ` Ken Garlington
2000-03-28 0:00 ` Robert Dewar
2000-03-28 0:00 ` Ken Garlington
2000-03-28 0:00 ` Marin D. Condic
2000-03-28 0:00 ` Robert Dewar
2000-03-29 0:00 ` Richard D Riehle
2000-03-29 0:00 ` Robert Dewar
2000-03-30 0:00 ` Alfred Hilscher
2000-04-01 0:00 ` Robert Dewar
2000-04-04 0:00 ` Alfred Hilscher
2000-04-05 0:00 ` Ole-Hjalmar Kristensen
2000-04-05 0:00 ` Larry Kilgallen
2000-04-06 0:00 ` Ole-Hjalmar Kristensen
2000-04-06 0:00 ` OS Bindings (was: Where is the elusive jump command?) Larry Kilgallen
2000-04-06 0:00 ` Ole-Hjalmar Kristensen
2000-04-06 0:00 ` Robert Dewar
2000-04-07 0:00 ` Tarjei T. Jensen
2000-04-09 0:00 ` Robert Dewar
2000-04-10 0:00 ` Tarjei T. Jensen
2000-04-12 0:00 ` Robert Dewar
2000-04-12 0:00 ` Tarjei T. Jensen
2000-04-12 0:00 ` Robert Dewar
2000-04-13 0:00 ` Tarjei T. Jensen
2000-04-15 0:00 ` Robert Dewar
2000-04-15 0:00 ` Tarjei T. Jensen
2000-04-12 0:00 ` Robert A Duff
2000-04-12 0:00 ` Tarjei T. Jensen
2000-04-12 0:00 ` Robert A Duff
2000-04-12 0:00 ` Florian Weimer
2000-04-12 0:00 ` Robert Dewar
2000-04-12 0:00 ` Robert A Duff
2000-04-15 0:00 ` Robert Dewar
2000-04-15 0:00 ` Gisle S�lensminde
2000-04-15 0:00 ` Robert Dewar
2000-04-13 0:00 ` Tarjei T. Jensen
2000-04-13 0:00 ` Gisle S�lensminde
2000-04-13 0:00 ` Tarjei T. Jensen
2000-04-13 0:00 ` Robert A Duff [this message]
2000-04-18 0:00 ` Tarjei T. Jensen
2000-04-15 0:00 ` Robert Dewar
2000-04-15 0:00 ` Tarjei T. Jensen
2000-04-12 0:00 ` Robert Dewar
2000-04-12 0:00 ` Robert Dewar
[not found] ` <eisner comp.lang.ada:53670>
2000-04-06 0:00 ` Larry Kilgallen
2000-04-06 0:00 ` Robert Dewar
2000-04-08 0:00 ` nickerson
2000-04-09 0:00 ` Robert Dewar
2000-03-30 0:00 ` Where is the elusive jump command? Richard D Riehle
2000-04-01 0:00 ` Robert A Duff
2000-04-02 0:00 ` Robert Dewar
2000-04-02 0:00 ` Richard D Riehle
2000-04-02 0:00 ` Robert Dewar
2000-04-02 0:00 ` Robert Dewar
2000-03-29 0:00 ` Marin D. Condic
2000-03-29 0:00 ` Gary Scott
2000-03-29 0:00 ` Robert Dewar
2000-03-30 0:00 ` Gary Scott
2000-03-30 0:00 ` David Starner
2000-03-30 0:00 ` Marin D. Condic
2000-03-30 0:00 ` Samuel T. Harris
2000-03-30 0:00 ` Gary Scott
2000-03-31 0:00 ` Tarjei T. Jensen
2000-03-31 0:00 ` Larry Kilgallen
2000-03-31 0:00 ` Gary Scott
2000-03-30 0:00 ` Larry Kilgallen
2000-03-30 0:00 ` Dan Nagle
2000-03-30 0:00 ` Samuel T. Harris
2000-03-31 0:00 ` Gisle S�lensminde
2000-03-30 0:00 ` David Starner
2000-03-31 0:00 ` Gisle S�lensminde
2000-03-31 0:00 ` Tarjei T. Jensen
2000-04-12 0:00 ` Robert A Duff
2000-04-12 0:00 ` Stanley R. Allen
2000-04-12 0:00 ` Samuel T. Harris
2000-04-13 0:00 ` Stanley R. Allen
2000-04-14 0:00 ` Samuel T. Harris
2000-04-14 0:00 ` BASIC->Ada, was " tmoran
2000-04-15 0:00 ` Robert Dewar
2000-04-15 0:00 ` Robert Dewar
2000-04-13 0:00 ` Tarjei T. Jensen
2000-03-31 0:00 ` Gautier
2000-03-30 0:00 ` Gautier
2000-03-30 0:00 ` Gary Scott
2000-03-30 0:00 ` David Starner
2000-03-30 0:00 ` William B. Clodius
2000-03-30 0:00 ` Gautier
2000-03-30 0:00 ` Alfred Hilscher
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox