What are the preconditions of newArray#

Johan Tibell johan.tibell at gmail.com
Mon Aug 22 18:08:20 CEST 2011


I agree (unless it has a performance cost). I had to fix a couple of
bugs in my code associated with generating zero-length arrays.

On Mon, Aug 22, 2011 at 5:54 PM, Edward Kmett <ekmett at gmail.com> wrote:
> It would still be nice to have a consistent base case.
>
> On Mon, Aug 22, 2011 at 3:43 AM, Johan Tibell <johan.tibell at gmail.com>
> wrote:
>>
>> On Mon, Aug 22, 2011 at 5:55 AM, Edward Z. Yang <ezyang at mit.edu> wrote:
>> > stg_newArrayzh in rts/PrimOps.cmm doesn't appear to give any indication,
>> > so this might be a good patch to add.  But I'm curious: what would
>> > allocating Array#s of size 0 do? Null pointers? That sounds dangerous...
>>
>> I would imagine that a zero sized array would be a StgArrPtrs header
>> with its size field set to 0. It's not a very useful thing to have, I
>> admit. If someone (Simon?) can confirm that we don't intend to support
>> zero-length array I'll push a patch that adds a comment.
>>
>> Johan
>>
>> _______________________________________________
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at haskell.org
>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
>



More information about the Glasgow-haskell-users mailing list