Hi,
On 18/11/21 05:18, Zebediah Figura (she/her) wrote:
+ if (!hlsl_array_reserve(ctx, (void**)&state->variables, &state->capacity, state->depth + 2, sizeof(*state->variables)))
"state->depth + 2" looks wrong; is it?
Wait, never mind, I see why this looks wrong. The fact that "depth" is 1-biased seems confusing to me, though...
I agree it is a bit strange, but I think it's correct too.
As whether to store the recursion depth or the number of stack levels (which is depth + 1), I think it's a matter of tastes. If you want "+ 1" here, you'll have a lot of "- 1" in other places (mostly _get_variable and _create_variable). I like depth more (mostly because I like to initialize things to zero), but I am flexible here.
Giovanni.