comp.lang.ada
 help / color / mirror / Atom feed
From: Clayton Weaver <cgweav@eskimo.com>
Subject: Re: Overflows (lisp fixnum-bignum conversion)
Date: 1997/04/05
Date: 1997-04-05T00:00:00+00:00	[thread overview]
Message-ID: <Pine.SUN.3.96.970405054237.22894A-100000@eskimo.com> (raw)
In-Reply-To: E82sM5.Gwv@world.std.com


(Is this nit-picking? Just a special case for the lisp fixnum to bignum
conversion:)

On Thu, 3 Apr 1997, Robert A Duff wrote:

> Analogy: Suppose you write a signed integer expression that overflows.
> In C, you get unpredictable results (exactly what Ada calls erroneous).
> In Ada, you get a run-time error.  In Lisp, you get the right answer.
> It seems to me that, as far as preventing bugs goes, with respect to
> this particular issue, C is worst, Ada is better (because it detects the
> error), and Lisp is better still (because it prevents the error).
> [Before somebody starts a three-way language war -- please note that I
> said "with respect to this particular issue"!]

Suppose the integer expression that overflows is used to determine the
index size for an array allocation.
 
Std lisp limits array indexes to fixnums. Lisp can transparently cast the
overflowing representation from fixnum to bignum, but it will still error
if it tries to allocate an array ("vector") with an index size beyond the
fixnum bound, unless you have a custom handler for that case that either
changes the array to some other storage type or virtualizes the data
structure into an array of arrays, and sets a flag that whatever function
accesses that array can read to change its lookup method.

Regards, Clayton Weaver  cgweav@eskimo.com  (Seattle)





  parent reply	other threads:[~1997-04-05  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-02  0:00 What Happened While I Wasn't Looking? Charles H. Sampson
1997-04-03  0:00 ` Robert A Duff
1997-04-03  0:00   ` Robert Dewar
1997-04-03  0:00   ` Robert Dewar
1997-04-05  0:00   ` Clayton Weaver [this message]
1997-04-05  0:00     ` Overflows (lisp fixnum-bignum conversion) Robert Dewar
1997-04-08  0:00       ` Robert A Duff
1997-04-09  0:00         ` Charles H. Sampson
1997-04-06  0:00     ` Robert A Duff
1997-04-06  0:00       ` Nick Roberts
1997-04-07  0:00         ` Robert A Duff
1997-04-07  0:00           ` Robert Dewar
1997-04-07  0:00             ` Larry Kilgallen
1997-04-07  0:00               ` Robert Dewar
1997-04-09  0:00                 ` Robert A Duff
1997-04-07  0:00               ` Nick Roberts
1997-04-07  0:00                 ` Robert Dewar
1997-04-09  0:00               ` Joel VanLaven
1997-04-12  0:00                 ` Architectures Nick Roberts
1997-04-05  0:00   ` What Happened While I Wasn't Looking? Nick Roberts
1997-04-07  0:00   ` Charles H. Sampson
1997-04-09  0:00     ` Robert A Duff
1997-04-07  0:00   ` Charles H. Sampson
1997-04-08  0:00 ` Overflows (lisp fixnum-bignum conversion) Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1997-04-08  0:00 Marin David Condic, 561.796.8997, M/S 731-93
replies disabled

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