[M3devel] 64bit INTEGERs, WIDECHAR: language specified or configuration/target dependent?
Hendrik Boom
hendrik at topoi.pooq.com
Thu May 28 16:18:11 CEST 2015
On Wed, May 27, 2015 at 06:30:50PM -0500, Rodney M. Bates wrote:
> Once more, with feeling.
>
> On 05/27/2015 11:14 AM, Hendrik Boom wrote:
> >On Wed, May 27, 2015 at 09:17:17AM -0700, mika at async.caltech.edu wrote:
> >>
> >>Hmm?
> >>
> >>Modula-3's INTEGERs are the "integers" of mathematics. The intent is
> >>that if your implementation is limited and doesn't support a particular
> >>operation because it goes out of range, your computation aborts. Same
> >>as any other implementation limitation.
> >>
> >>There is no reason I can think of you couldn't come up with an implementation
> >>that has unlimited-range integers. FIRST(INTEGER) and LAST(INTEGER) would have
> >>to be a little special.
> >
> >That was, in essence, my proposal for LONGINT, not for INTEGER.
> >We still need an integer length that's efficient. I wasn't proposing to
> >change the definition of INTEGER, FIRST(INTEGER), and so forth.
> >
> >But if one had a base tyoe of LONGINT and forbade declaring anything of
> >type LONGINT, you could still have BITS 45 FOR LONGINT and the like.
I should probably have said something like -2^44-1 .. 2^44, or
whatever those numbers are when spelled out in decimal. Of course the
syntax for this might still have to indicate LONGINT somehow,
because I'd have doubts about the base type depending on the size of
the numbers I coded. The base type affects a lot of assumptions about
things like the default subscript type for dynamic arrays and the
like.
>
> TYPE U = BITS n FOR T *does not change the range of values.* The range
> of U is the same as that of T.
WHich is why I should have used a range instead of a number of bits.
>
> If you try to stuff it into too few bits, e.g., BITS 4 FOR [ 0 .. 255 ],
> it is a static error.
>
> If you try to assign a value outside the value range, it is an error,
> generally at runtime, even if that value would fit in the bit count.
> E.g., VAR V : BITS 16 FOR [ 0 .. 255 ] := 256 is illegal.
>
> The *only* thing BITS n FOR does is, if legal, affect the amount of
> storage the compiler allocates, and *only for array elements and
> fields of RECORDs and OBJECTs*.
...
> >
> >In fact, one could possibly define INTEGER to be BITS 32 FOR
> >LONGINT, but that might involve further consequences in corrner
> >case in the language.
> >
> >-- hendrik
> >
> >>
> >> Mika
> >
>
> --
> Rodney Bates
> rodney.m.bates at acm.org
More information about the M3devel
mailing list