comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: Question for the folks who designed Ada95
Date: 1999/04/28
Date: 1999-04-28T23:28:54+00:00	[thread overview]
Message-ID: <yeczp3s9vf3.fsf@king.cts.com> (raw)
In-Reply-To: wcceml4hhl3.fsf@world.std.com

Robert A Duff <bobduff@world.std.com> writes:
[...]
> We didn't think it was necessary -- you can always multiply by 2 or
> whatever.  Optimizing that to a shift instruction is trivial, and if you
> care about efficiency, surely you should be using an optimizing compiler
> that is *at least* that smart.  (After all, I want that optimization for
> signed integers, too!)

That's fine if the size of the shift is a constant, but as someone
else has pointed out, it's more difficult if it's a variable.  I
suppose a compiler could optimize
    
    X := X * 2**N;

to a shift instruction, but I'd hate to have to depend on it.

> It's not clear what shifting should mean if the modulus is not a power
> of 2.  Robert has stated many times that that should never have been
> allowed, and I tend to agree.

Do you mean that shifting should not be allowed for such types, or
that the types themselves should not be allowed?  Either way, I also
tend to agree.  Non-power-of-two modular types remind me of
enumeration representation clauses -- something that was added for the
sake of completeness, but that's more trouble to define and implement
than it's really worth.

If non-power-of-two modular types are really worth having in the
language, it might have been nice to make them a distinct class of
type, like decimal fixed-point vs. ordinary fixed-point.  That would
allow providing shifts as attributes without running into generic
contract model problems.  I think.

Disclaimer: I've been mostly out of touch with Ada for the last couple
of years, so I've probably made some mistakes.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center  <http://www.sdsc.edu>                 <*>
Techno-geek.  Mouse bigger than phone.  Bites heads off virtual chickens.




  reply	other threads:[~1999-04-28  0:00 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-26  0:00 Question for the folks who designed Ada95 Corey Ashford
1999-04-27  0:00 ` Matthew Heaney
1999-04-27  0:00   ` Corey Ashford
1999-04-28  0:00     ` Marin David Condic
1999-04-28  0:00     ` Robert A Duff
1999-04-28  0:00       ` Keith Thompson [this message]
1999-04-29  0:00         ` Robert A Duff
1999-04-27  0:00   ` Matthew Heaney
1999-04-27  0:00 ` Samuel Mize
1999-04-27  0:00   ` Samuel Mize
1999-04-27  0:00     ` Robert Dewar
1999-04-28  0:00       ` Corey Ashford
1999-04-28  0:00         ` Robert Dewar
1999-04-29  0:00           ` Corey Ashford
1999-04-29  0:00             ` Robert Dewar
1999-04-29  0:00               ` Fraser Wilson
1999-04-29  0:00                 ` Marin David Condic
1999-04-29  0:00                 ` Robert Dewar
1999-04-28  0:00       ` Samuel Mize
1999-04-28  0:00         ` Samuel Mize
1999-04-28  0:00     ` Corey Ashford
1999-04-28  0:00     ` Corey Ashford
1999-04-27  0:00 ` Robert Dewar
1999-04-27  0:00   ` Tarjei Tj�stheim Jensen
1999-04-27  0:00     ` Larry Kilgallen
1999-04-27  0:00     ` Robert Dewar
1999-04-28  0:00       ` Corey Ashford
1999-04-28  0:00         ` Robert Dewar
1999-04-28  0:00           ` Robert A Duff
1999-04-28  0:00             ` Robert Dewar
1999-04-29  0:00               ` Robert A Duff
1999-04-29  0:00           ` Corey Ashford
1999-04-29  0:00             ` Corey Ashford
1999-04-29  0:00             ` Robert Dewar
1999-04-29  0:00               ` Fraser Wilson
1999-04-29  0:00                 ` Tucker Taft
1999-04-29  0:00                 ` Mark A Biggar
1999-04-30  0:00                   ` Tucker Taft
1999-04-29  0:00                 ` Marin David Condic
1999-04-30  0:00                 ` David Brown
1999-04-29  0:00               ` Geert Bosch
1999-04-27  0:00     ` bill
1999-04-27  0:00       ` Robert Dewar
1999-04-27  0:00         ` Al Christians
1999-04-27  0:00           ` Larry Kilgallen
1999-04-27  0:00             ` Al Christians
1999-04-28  0:00         ` Robert A Duff
1999-04-28  0:00           ` Robert Dewar
1999-04-29  0:00             ` Matthew Heaney
1999-04-29  0:00               ` Robert Dewar
1999-04-29  0:00               ` Jean-Pierre Rosen
1999-04-27  0:00       ` dennison
1999-04-27  0:00         ` Robert Dewar
1999-04-29  0:00           ` Robert A Duff
1999-04-27  0:00     ` David Starner
1999-04-27  0:00       ` Robert Dewar
1999-04-27  0:00         ` David Starner
1999-04-28  0:00           ` Samuel Mize
1999-04-28  0:00           ` Robert Dewar
1999-04-28  0:00         ` Tarjei Tj�stheim Jensen
1999-04-28  0:00           ` Larry Kilgallen
1999-04-28  0:00           ` Robert Dewar
1999-04-28  0:00             ` Robert A Duff
1999-04-29  0:00             ` Tarjei Tj�stheim Jensen
1999-04-29  0:00             ` Bill Ghrist
1999-04-28  0:00           ` dennison
1999-04-28  0:00             ` Robert Dewar
1999-04-28  0:00               ` Robert A Duff
1999-04-28  0:00                 ` Brian Hanson
1999-04-28  0:00                   ` bill
1999-04-29  0:00                     ` Robert Dewar
1999-04-28  0:00                       ` Pat Rogers
1999-04-29  0:00                         ` Robert Dewar
1999-04-29  0:00                           ` dennison
1999-04-29  0:00                             ` Pat Rogers
1999-04-29  0:00                     ` Robert S. White
1999-04-29  0:00                       ` Robert Dewar
1999-04-30  0:00                         ` Robert S. White
1999-04-30  0:00                           ` dennison
1999-04-29  0:00                       ` Robert Dewar
1999-04-30  0:00                         ` Robert S. White
1999-04-30  0:00                 ` Robert Dewar
1999-04-28  0:00           ` Robert A Duff
1999-04-29  0:00           ` Question for the folks who designed Ad David Kristola
1999-04-29  0:00             ` Paul Duquennoy
1999-04-29  0:00     ` Question for the folks who designed Ada95 Aidan Skinner
1999-04-30  0:00       ` Matthew Heaney
1999-04-27  0:00   ` Corey Ashford
replies disabled

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