v7 icon indicating copy to clipboard operation
v7 copied to clipboard

v7_array_length issue

Open biyuexiug opened this issue 7 years ago • 1 comments

include <stdio.h> #include "v7.h"

int main(void) { struct v7* v7 = v7_create(); v7_val_t a = v7_mk_array(v7);

v7_array_push(v7, a, v7_mk_number(v7, 0));
v7_array_push(v7, a, v7_mk_number(v7, 1));
v7_array_push(v7, a, v7_mk_number(v7, 2));
printf("%d\n", v7_array_length(v7, a));

v7_array_del(v7, a, 0);
printf("%d\n", v7_array_length(v7, a));

v7_destroy(v7);
return 0;

}

the output is: 3 3 if I change v7_array_del(v7, a, 0); to v7_array_del(v7, a, 2); the output is: 3 2

it seems that only the last entry can be deleted

biyuexiug avatar Jul 28 '17 01:07 biyuexiug

FYI - the development of v7 is currently suspended in favor of https://github.com/cesanta/mjs

cpq avatar Jul 28 '17 09:07 cpq