From: Ken Garlington <garlingtonke@lmtas.lmco.com>
Subject: Re: Prevalence of Compilers for Which Integer'Size < 32?
Date: 1996/08/07
Date: 1996-08-07T00:00:00+00:00 [thread overview]
Message-ID: <32089CC9.2C19@lmtas.lmco.com> (raw)
In-Reply-To: dewar.839076864@schonberg
Robert Dewar wrote:
>
> You missed my point, case (b) is *exactly* the case where the name
> Word_Length_In_Bits might be appropriate if that is what you really
> want. Of course if you use the software somewhere where the machine
> word is not 32-bits, then you would have to modify this declaration.
Perhaps I misunderstood. I thought the intent was to declare an integer
value that would always fit in 32 bits, regardless of machine word
size. If that's the case, wouldn't Word_Length_In_Bits always be 32,
for all machines, for the code I gave earlier? And, if that's the case, wouldn't
a maintainer seeing this on a 16-bit machine say, "Wait a minute, word length
isn't 32 on my machine, better change this to 16..." - and end up with anInt32
being a 16-bit value?
> Ada code can be made to be automatically portable most of the time, but
> not necessarily all the time, since the predefined set of attributes is
> not necessarily powerful enough to parametrize everything you want.
> In this particular case, if you really wanted the machine word size
> to govern the length of the type, you could probably use
> System.Word_Size (or in GNAT Standard'Word_Size) and completely avoid
> the dreaded 32, in the declaration as *well* as in the name.
I think this is true if anInt32 was supposed to be anIntWord. If that was the
intent, I misunderstood. I thought the original thread was: How do I make
an integer that will always be 32 bits, even on a 16 bit machine? and the
answer was:
Optimal_Name : constant := 32;
type anInt32 is range -(2**(Optimal_Name-1)) .. 2**(Optimal_Name-1)-1;
or something to that effect?
--
LMTAS - "Our Brand Means Quality"
next prev parent reply other threads:[~1996-08-07 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 [this message]
1996-07-28 0:00 ` Dave Marshall
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