Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: BUG: Assigning a string to an array via a reference fails to change its type



Philippe Altherr wrote:
> The patch adds a new field "isrefslice" to the  "value" struct. My first
> thought was to piggyback on the existing fields "start" and "end" but that
> didn't work out. Iirc, the problem was that these fields were sometimes
> (always?) initialized even for references to plain arrays (without any
> subscripts).

What about the flags field? Your isrefslice is logically just a boolean,
right? So it could be another VALFLAG item in the enum. There's not so
many places in the code to check to see whether instances of v.flags = 0
actually need to only mask off the other three bits or equivalents for
other assignments.

Currently, checking sizeof(struct value) in gdb says 40. That code must
have been written on 32-bit systems when pointers and ints were the same
size. On a 64-bit system that uses 32-bits for int, rearranging the
fields to put the two pointer fields first would give it a size of 32
bytes. As a power of two, that reduction could be well worth doing.

Oliver




Messages sorted by: Reverse Date, Date, Thread, Author