bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in make-shared-array.


From: Marius Vollmer
Subject: Re: Bug in make-shared-array.
Date: 02 May 2006 01:13:22 +0300
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Neil Jerram <address@hidden> writes:

> And at line 899 this code -
> 
>       if (s[k].ubnd < s[k].lbnd)
>       {
>         if (1 == SCM_I_ARRAY_NDIM (ra))
>           ra = make_typed_vector (scm_array_type (ra), 0);
>         else
>           SCM_I_ARRAY_V (ra) = make_typed_vector (scm_array_type (ra), 0);
>         scm_array_handle_release (&old_handle);
>         return ra;
>       }
> 
> - suggests that the function will do something completely different if
> one of the dimensions of the new array has a negative increment.

No, ubnd < lbnd does not mean that the increment is negative.  Ubnd
and lbnd are always sorted so that the smallest legal index is lbnd
and the largest legal index is ubnd (for the dimension at hand).  When
ubnd is smaller than lbnd, the index range in that dimension is emtpy
and the whole array has zero elements, consequently.  The test in your
snippet 'optimizes' for that case.  (Makes me cringe.)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

[Prev in Thread] Current Thread [Next in Thread]