From: f22ellis@mass.rsg.hac.com (Mike Ellis.......(310) 334-1652)
Subject: Re: Ada83 or DEC Ada: Feature or bug?
Date: 5 Oct 1994 07:59:24 GMT
Date: 1994-10-05T07:59:24+00:00 [thread overview]
Message-ID: <36tmcs$7sh@hacgate2.hac.com> (raw)
In-Reply-To: CwrGBu.CJr@lazrus.cca.rockwell.com
In article <CwrGBu.CJr@lazrus.cca.rockwell.com>, wemagor@fms0.cca.rockwell.com (Wayne Magor) writes:
>In article <360ecv$kq1@hacker.demon.co.uk>, steve@hacker.demon.co.uk (Stephen M. Youndt) writes:
>>Is it a feature of Ada83 or DEC Ada that makes it impossible to work with
>>unsigned values? MAX_INT always bites back with CONSTRAINT_ERROR when I try
>>to do any real work with unsigned 32bit values (i.e. SYSTEM.UNSIGNED_LONGWORD).
>>Both I and my coworkers find this terribly annoying. Is this part of Ada83
>>or a DEC Ada peculiarity? If Ada83, will it be fixed in 9X?
>
>This was a problem with Ada83 which is fixed in Ada-9X. DEC defined
>System.Unsigned_Longword like this:
>
> type UNSIGNED_LONGWORD is range -2_147_483_648 .. 2_147_483_647;
> for UNSIGNED_LONGWORD'SIZE use 32;
According to DEC's Ada developers, the relevant language clauses are
3.5.4 (7) "The range of each of these types must be symmetric about
zero, excepting a possible extra negative value which may exist in some
implementations." All integer type declarations must follow 3.5.4 (6),
and be derived from a predefined type, and hence must be symmetric. This
means that to support 0..16#FFFF_FFFF# one would have to support at
least 33 bit integers, probably 64, which in turn would radical impact
on the compiler itself, the descriptors used to pass parameters, the
runtime support, etc.
This would be valid iff it were not for the fact that the deffinition
appears in the *PACKAGE SYSTEM*. This clause applies to "The predefined
integer types..." The type in question (UNSIGNED_LONGWORD) is provided
via the SYSTEM package and need not be implemented as any particular
type. Language clause 13.7 (1) states that "The specification of the
package SYSTEM is implementation-dependent...". Appendix F which
documents the DEC Ada implementation of the package system further
states "This appendix is not part of the standard definition of the Ada
programming language." An example of this may be found in the
implentation of the type SYSTEM.ADDRESS which is private and hence its
implementation is not visible to the Ada programmer. While simple math
opperations involving a mixture of the type ADDRESS and the type INTEGER
have been defined, there is nothing which defines the type ADDRESS to be
a subtype of the INTEGER class.
The "DEC Ada Run-Time Reference Manual" discusses the implementation of
system.unsigned_longword in section 9.3.2 in the V3.0 manual.
It would not be so bad if the *PARSER* could handle a 32 bit unsigned
number. One could easily write routines in MACRO (or any other language
for that matter) to perform opperations on the 32 bit qunatities and do
a pragma Interface. Since the compiler won't let one specify a number
of value greater than 31 bits (e.g. 16#FFFF_FFFF#) without resorting to
tactics such as the use of overlays or negative numbers, there is not a
clean, efficient way to deal with this limitation. If performance is
not an issue, one could always use bit arrays and re-invent addition,
subtraction, multiplication, etc. Another way to deal with the math
part of the problem would be to provide an exception handler, do the
math normaly and then deal with the exceptions on a bit array or simular
basis.
ME
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
F22Ellis@Radium.Hac.Com M. D. to patient: First the good news --
you're going to have a disease named after you.
prev parent reply other threads:[~1994-10-05 7:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-09-24 5:45 Ada83 or DEC Ada: Feature or bug? Stephen M. Youndt
1994-09-25 12:32 ` Tucker Taft
1994-09-26 12:54 ` Robert Dewar
1994-09-26 23:38 ` Wayne Magor
1994-09-27 12:35 ` Bevin R. Brett
1994-10-05 7:59 ` Mike Ellis.......(310) 334-1652 [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox