[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix for `make-uniform-array'
From: |
Marius Vollmer |
Subject: |
Re: [PATCH] Fix for `make-uniform-array' |
Date: |
Sun, 12 Feb 2006 03:08:13 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Kevin Ryde <address@hidden> writes:
> address@hidden (Ludovic Courtès) writes:
>>
>> $ ./pre-inst-guile # i.e., 1.7
>> guile> (define a (make-uniform-array #\nul 10))
>> ERROR: Wrong type (expecting exact integer): #\nul
>> ABORT: (wrong-type-arg)
>
> That's a bug. In 1.6 you could pass chars to array-set! (and fill)
> with a #\nul (ie. byte) uniform array, that should still be possible.
Yes and no. It's a bug that (make-uniform-array #\nul 10) fails, but
it is was a conscious incompatible change that uniform numeric arrays
can no longer store characters.
The bug was actually in scm_dimensions_to_uniform_array: when the
'fill' parameter was unspecified, the prototype should have been used
for filling, but was not.
Thus, I made the following changes:
* deprecated.scm (make-uniform-array): Don't pass the prototype as
the fill value, dimensions->uniform-array will do the right thing
now. See scm_dimensions_to_uniform_array why we need to be tricky
about the fill value.
* unif.c (scm_dimensions_to_uniform_array): Use the prototype for
filling when the fill parameter is omitted, as documented, but
turn #\nul into 0 since s8 arrays (signified by a #\nul prototype)
can not store characters.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405