#include <stdlib.h>
#include "list.h"
int main(){
list_t *gc = list_new();
list_node_t *node = list_append(gc, list_node_new("foo"));
list_node_t *node_2 = list_append(gc, list_node_new("bar"));
printf("node: %s, node_2: %s\n", (char*)node->val, (char*)node_2->val);
list_remove(gc, node);
printf("length: %d\n", gc->len);
printf("node: %s, node_2: %s\n", (char*)node->val, (char*)node_2->val);
return 0;
}
node: foo, node_2: bar
length: 1
node: foo, node_2: bar
Output:
Is this a bug, or it's some compiler caching?