comp.lang.ada
 help / color / mirror / Atom feed
From: dmarshal@netcom.com (Dave Marshall)
Subject: Re: Prevalence of Compilers for Which Integer'Size < 32?
Date: 1996/07/28
Date: 1996-07-28T00:00:00+00:00	[thread overview]
Message-ID: <dmarshalDv8t9y.Bq8@netcom.com> (raw)
In-Reply-To: 4tdp24$5h1@news.pacifier.com


steved@pacifier.com@199.2.117.163  (Steve Doiel) writes:

>Dave Marshall writes:
>>So here I am, looking at some old code while I wonder what I was
>>thinking when I wrote it.  Suddenly, I see something that will raise
>>Constraint_Error if a compiler's Integer'Size is less than 32.
>>
>Sorry for not answering your question but...

>In my experience I have found that if portablilty is a concern, then all
>predefined types should be avoided.

It's impossible to disagree with this.  Indeed, I believe that
explicitly declaring one's types rather than using predefined types
adds to code's maintainability to an even greater degree.

However, the thrust of my question was more towards the available
values for integer types rather than any specific typing schemes.  I
apologize for not having been so unspecific.

My specific question revolves around something such as this example
that you'll find in a lot of time-handling packages.

type Seconds_In_A_Day is range 0 .. 86_400;

This is going to work fine for compilers for which Integer'Size is 32,
but it will fail for compilers for which Integer'Size = 16.  Of
course, this is because the above statement is equivalent to

type some_anonymous_integer_type is new Integer;
subtype Seconds_In_A_Day is some_anonymous_integer_type range 0 ..86400;

If Integer'Last is 65535, ka-bloowie.

Rather than make another entry in the predefined-types versus
user-defined-types battles, I thought I'd just get right to the matter
and try to get the information I was after.
-- 
Dave Marshall
dmarshal@netcom.com





  parent reply	other threads:[~1996-07-28  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-26  0:00 Prevalence of Compilers for Which Integer'Size < 32? Dave Marshall
1996-07-27  0:00 ` steved
1996-07-28  0:00   ` Robert A Duff
1996-07-30  0:00     ` Ken Garlington
1996-07-30  0:00       ` Robert Dewar
1996-08-01  0:00         ` steved
     [not found]         ` <31FF5CF0.5C13@lmtas.lmco.com>
1996-08-03  0:00           ` Robert Dewar
1996-08-07  0:00             ` Ken Garlington
1996-07-28  0:00   ` Dave Marshall [this message]
1996-07-28  0:00     ` Robert A Duff
1996-07-28  0:00       ` Robert Dewar
1996-07-29  0:00         ` Robert A Duff
1996-07-28  0:00     ` Robert Dewar
1996-07-28  0:00     ` steved
  -- strict thread matches above, loose matches on Subject: below --
1996-07-28  0:00 tmoran
1996-07-29  0:00 ` John Herro
replies disabled

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