On Mon, Aug 05, 2024 at 11:45:56AM +0200, Alejandro Colomar wrote:
> [CC += Kees, Qing]
>
> Hi Joseph,
>
> On Sun, Aug 04, 2024 at 08:34:24PM GMT, Alejandro Colomar wrote:
> > On Sun, Aug 04, 2024 at 08:02:25PM GMT, Martin Uecker wrote:
> > D'oh! I screwed it. I wanted to have written this:
> >
> > $ cat star.c
> > void foo(char (*a)[3][*], int (*x)[__lengthof__(*a)]);
>
> I think this answers your question of if we want __lengthof__ to
> evaluate its operand if the top-level array is non-VLA but an inner
> array is VLA.
>
> We clearly want it to not evaluate, because we want this __lengthof__
> to be a constant expression, ...
But if you don't evaluate the argument, you can't handle counted_by.
Because for counted_by you need the expression (the object on which it is
used).
Jakub