Hi Alexander,

>   struct {
>     int vla[g()]; // vla-member, int array of size g()
>   } s; 
> The patch attached translates all uses of bindFrame as an anonymous struct
> with a VLA-member to a combination of a regular byte-vla for memory and a
> bindFrame pointer into that memory.

Cool! I was under the assumption that clang prohibits dynamically sized arrays
in general, not just in structures. But when looking at your changes, using
basically

   int bndLen = length(y)+2;
   char fbuf[bindFrameSize(bndLen)];

instead of

   struct {  // bindFrame
      struct bindFrame *link;
      int i, cnt;
      struct {any sym; any val;} bnd[length(y)+2];
   } f;

I deduce that you still can use an dynamically sized array. After all, length(y)
is called at runtime.


> This requires the bindFrame uses in question to use indirection, rendering the
> patch a bit noisy.

Yes, and probably some runtime overhead due to the indirection (though the same
overhead must be there anyway, albeit hidden in the syntax).



> As far as I'm aware and able to test, the behavior is identical.

Cool!


> Overall the code is slightly shorter because the bindFrame struct is not
> redefined as an anonymous struct 11 times throughout the code.

Well, but this is only the source code for the definitions, right? I expect it
does not generate runtime code.


> I'm not able to fully test everything because I'm struggling with the test
> suite; I don't know whether this is due to me using macOS or misusing
> PicoLisp.

Doesn't this

   $ ./pil lib/test.l -bye +

work? Sorry, I don't have a 32-bit system available any more.

Mike, how about you? I'm sure you are our absolute testing guru! ;)


> The patch is generated from the git mirror but applies to the source in 
> picoLisp-18.6.tgz
> 
> I'm happy about all feedback.

If it runs fine, I could release the patched files.

♫ Alex

-- 
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe

Reply via email to