On Sun, 29 Jun 2008, Andrew Whitworth wrote:

> There are a few other simplifications that I think can be made also.
> For instance, in calculating the size of a new Stack_Chunk_t, we use
> the convoluted equation "size = sizeof(Stack_Entry_t) +
> offsetof(Stack_Chunk_t, u.data)", which is much more easily written as
> "size = sizeof(Stack_Chunk_t)". I assume, based on this complexity,
> that the size of a stack chunk's payload was variable, but it appears
> now that there is only one kind of stack, and one size of payload.
It used to be that the u.data member of Stack_Chunk_t was a void *, so
the sizeof() calculation was necessary to figure out how much space was
really needed.  A couple of months ago, I changed that to a Stack_Entry_t,
since that's all u.data was ever used as anyway.

So yes, you now ought to be able to simply use sizeof(Stack_Chunk_t).

Incidentally, while you're at it, you can safely remove the lines

    #if PARROT_PTR_ALIGNMENT > 1
        double d_dummy;
    #endif

since correct alignment of u.data is now guaranteed by the compiler.
Further, if you wish, the whole union can go, since the only purpose of
the union was to force correct alignment.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to