comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: OS Bindings (was: Where is the elusive jump command?)
Date: 2000/04/15
Date: 2000-04-15T00:00:00+00:00	[thread overview]
Message-ID: <8d9pkm$2k5$1@nnrp1.deja.com> (raw)
In-Reply-To: 8d41rd$6622@ftp.kvaerner.com

In article <8d41rd$6622@ftp.kvaerner.com>,
  "Tarjei T. Jensen" <tarjei.jensen@kvaerner.com> wrote:

> The modular semantics of a type like size_t in C is a side
> effect. It is wron to blindly translate any unsinged type to a
> modular type in Ada. The C designers used the unsigned type
> because it was available and had the require range and not
> because of its modular semantics.

Actually I have seen quite a bit of C code that uses the
type size_t for addressing computations (a not unreasonable
choice) where wrap around semantics is just what you want.

> Only a language lawyer would think that it would be sensible
> for size_t to be modular type in Ada.

Or someone who thinks it is a good idea to be completely
interoperable with C :-) Actually it is you who are operating
in language lawyer mode, and presuming to know the intent
of the designers, and restrict programmers accordingly :-)

> I think you will find it difficult to find many places in the
> standard C libraries where the modular semantics of any
> unsigned type is of importance or
> where anything would fail if the type was not modular.

Address computations using size_t are one of many examples.

> The situation is most likely to be quite the oposite; that
> errors or potential errors will be found which could have
> cause programs to fail in mysterious
> ways.

I think that's EXACTLY wrong, what could cause mysterious
failures is if the semantics of the Ada types that supposedly
mirror the C types are subtly different, and the differences
only show up in unusual cases.

The point you make is a valid one with respect to the original
design in C, it would have been nice in C to have unsigned types
with underfined overflow conditions, rather than defined
wrap around semantics. But given the choice that C designers
made, I think it is really far more appropriate for Ada to
copy these choices in providing analogous types in Ada than
to decide to "improve" on the C design.

When you are in the business of interfacing to a foreign
language, you do not want to intefere with the interoperability
of the interface by getting into the "that's terrible, we refuse
to do things that way in Ada" mode.

Indeed as I said above, it is language lawyers who make this
mistake, not pragmatic folks :-)



Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~2000-04-15  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   ` 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             ` Marin D. Condic
2000-03-29  0:00               ` Gary Scott
2000-03-29  0:00                 ` Robert Dewar
2000-03-30  0:00                   ` Gautier
2000-03-30  0:00                     ` Gary Scott
2000-03-30  0:00                       ` Gautier
2000-03-30  0:00                       ` David Starner
2000-03-30  0:00                         ` William B. Clodius
2000-03-30  0:00                   ` David Starner
2000-03-30  0:00                     ` Marin D. Condic
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                       ` Samuel T. Harris
2000-03-30  0:00                       ` Dan Nagle
2000-03-30  0:00                         ` David Starner
2000-03-30  0:00                         ` Samuel T. Harris
2000-03-31  0:00                           ` Gisle S�lensminde
2000-03-30  0:00                       ` Larry Kilgallen
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                       ` Gisle S�lensminde
2000-03-31  0:00                       ` Gautier
2000-03-30  0:00                   ` Gary Scott
2000-03-30  0:00               ` Alfred Hilscher
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
     [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-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                                       ` Robert A Duff
2000-04-12  0:00                                         ` Tarjei T. Jensen
2000-04-12  0:00                                           ` Robert Dewar
2000-04-12  0:00                                           ` Robert Dewar
2000-04-12  0:00                                           ` Robert A Duff
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-12  0:00                                             ` Florian Weimer
2000-04-13  0:00                                             ` Tarjei T. Jensen
2000-04-13  0:00                                               ` Robert A Duff
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                                       ` 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 [this message]
2000-04-15  0:00                                               ` Tarjei T. Jensen
2000-04-06  0:00                             ` Ole-Hjalmar Kristensen
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-28  0:00   ` Dale Stanbrough
replies disabled

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