Skip to content

Instantly share code, notes, and snippets.

@llelf
Last active April 27, 2020 20:57
Show Gist options
  • Save llelf/4ecd9bea0c4de3636a249c8dc26f3f6c to your computer and use it in GitHub Desktop.
Save llelf/4ecd9bea0c4de3636a249c8dc26f3f6c to your computer and use it in GitHub Desktop.
#define KXVER 3
#include"k.h"
#include<stdio.h>
#define PK(s,x) O("%15s: %p[r=%d] n=%lld %d..\n",s,x,x->r,x->n,*kI(x))
I main(){
I i=42;
K top1=ktn(KI,0), top2=ktn(KI,0), v=ktn(KI,0);
jk(&top1,r1(v)); jk(&top2,r1(v));
PK("v",v);
K v0=v; ja(&v,&i); PK("realloc +1",v);
K v1=v; DO(4,ja(&v,&i)); PK("realloc +4",v);
r0(top1); PK("r0(top1)",v);
r0(top2); PK("r0(top2)",v);
r0(v); PK("fin",v);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment