comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Problem using Ada.Text_IO.Modular_IO
Date: Thu, 10 Jul 2008 07:59:00 -0700 (PDT)
Date: 2008-07-10T07:59:00-07:00	[thread overview]
Message-ID: <32e35e5a-3cae-4fdc-be4a-3ae1e146e9f3@l64g2000hse.googlegroups.com> (raw)
In-Reply-To: rPidk.108628$102.102592@bgtnsc05-news.ops.worldnet.att.net

On Jul 10, 12:25 am, a...@anon.org (anon) wrote:
> It is easy to use and is tested and verified to work! To name one to
> two reasons!

Those don't seem like much of a reason.  Declaring your own type as
"mod 2**64" seems pretty darn easy.  And what exactly do you mean by
Unsigned_64 is "tested"?  Unsigned_64 is simply declared as "mod
2**64" (this is specified by the language); so are you saying that
operations on Unsigned_64 have been tested and have found to work
right, but if you declare your own "mod 2**64" you have to do your own
testing to make sure that operations on it work right?  I'm having
trouble interpreting your comment in a way that makes any sense.

Of course, it really doesn't matter which one you use (except,
perhaps, to help prevent incorrect type conversions).  The only
differences have to do with readability, pedagogy, and helping make
your programs self-documenting.  But ever since Ada was designed, the
position of the Ada community has been that it's better to avoid using
the standard numeric types provided by Ada (Integer, Float) and define
your own that explicitly include the numeric range you need.  You seem
to be going in the opposite direction, by recommending that this user
use a standard type provided by the language rather than defining his
own (although the standard type you recommend is certainly better
defined than Integer or Float).

Another issue is that an implementation doesn't have to provide
Interfaces.Unsigned_64.  It should be present on any target processor
whose addressable unit is an 8-bit byte or a 16-, 32-, or 64-bit
word.  But I've seen processors in the past that use 6-bit characters
or 36-bit words, and in those cases, using Unsigned_64 instead of "mod
2**64" will turn a portable program into a nonportable one.  I'll
grant that such processors are rare these days.

                                  -- Adam




  reply	other threads:[~2008-07-10 14:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09 16:52 Problem using Ada.Text_IO.Modular_IO jujosei
2008-07-09 19:03 ` Anh Vo
2008-07-09 19:22   ` Adam Beneschan
2008-07-09 21:50 ` Adam Beneschan
2008-07-10 15:00   ` jujosei
2008-07-10  0:48 ` anon
2008-07-10  1:52   ` Adam Beneschan
2008-07-10  7:25     ` anon
2008-07-10 14:59       ` Adam Beneschan [this message]
2008-07-11  0:34         ` anon
2008-07-11  9:49           ` Georg Bauhaus
2008-07-11 10:05             ` christoph.grein
2008-07-11 13:21               ` John McCormick
2008-07-11 12:16             ` anon
2008-07-11 13:26               ` petter_fryklund
2008-07-11 21:10                 ` anon
2008-07-12 10:06                   ` Georg Bauhaus
2008-07-13  0:51                     ` anon
2008-07-13 16:03                     ` Georg Bauhaus
2008-07-14  2:03                       ` anon
2008-07-14 13:12                         ` Georg Bauhaus
2008-07-16  6:16                           ` micronian2
2008-07-16  7:47                             ` anon
2008-07-17 16:33                               ` micronian2
2008-07-14 16:34                       ` micronian2
2008-07-14 17:26                         ` Georg Bauhaus
2008-07-16  6:28                           ` micronian2
replies disabled

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