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

Re: type-checking for metafiedness? (was: Re: Cores almost on demand in patcompile())



On Fri, 14 Oct 2016 06:36:25 +0000
Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> A 'char **' would become a 'struct metafied_t *', i.e., an array of
> structs.  This is not equivalent: the array stride of the latter may be
> larger than the array stride of the former.¹  However, this would only
> be a problem if the code makes assumptions about where elements are
> allocated relative to each other, e.g., if the code assumes that
> «ary[1] - ary[0] == 1+strlen(ary[0])» or otherwise uses the values of
> ary[N] and ary[M] in a single expression.
> 
> Does the code make such assumptions?

No, char ** is used fairly generically.

I don't think arrays of unmetafied strings are that common, and in at
least one case (the print builtin) having the length as part of the
unmetafied_t structure, avoiding a parallel length structure, is
beneficial.

pws



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