Question Vala! How amazing!
Vala has a useful parameter -Cthat allows you to look into the C code that it creates. This function, for example ...
int[] GetNumbers() {
return new int[] {1,2,3};
}
... when compiling with ...
valac -C -c test.vala
... will show the following C code (c test.c) ...
gint* GetNumbers (int* result_length1) {
gint* result = NULL;
gint* _tmp0_ = NULL;
gint* _tmp1_;
result = (_tmp1_ = (_tmp0_ = g_new0 (gint, 3), _tmp0_[0] = 1, _tmp0_[1] = 2, _tmp0_[2] = 3, _tmp0_), *result_length1 = 3, _tmp1_);
return result;
}
Pay attention to g_new0; so yes you want g_freeit.
, , , C: const, .