return null;
}
+
+malloc :: proc (size: u32) -> rawptr {
+ return alloc(^heap_allocator, size);
+}
+
+mfree :: proc (ptr: rawptr) {
+ free(^heap_allocator, ptr);
+}
\ No newline at end of file
asdf :: "staring asdfkjasd asdflkjasdflkajsdflk";
heap_init();
- first := cast([] i32) alloc(^heap_allocator, sizeof [4] i32);
+ first := cast([] i32) malloc(sizeof [4] i32);
for i: 0, 4 first[i] = i * 2;
- second := cast([] f32) alloc(^heap_allocator, sizeof [24] f32);
+ second := cast([] f32) malloc(sizeof [24] f32);
for i: 0, 24 second[i] = cast(f32) i;
print(cast(u32) first);
for i: 0, 4 print(first[i]);
for i: 0, 24 print(second[i]);
- free(^heap_allocator, first);
+ mfree(first);
- third := cast(^i32) alloc(^heap_allocator, sizeof i32);
+ third := cast(^i32) malloc(sizeof i32);
print(cast(u32) third);
*third = 1234;
print(*third);
- free(^heap_allocator, second);
+ mfree(second);
- fourth := cast([] i32) alloc(^heap_allocator, sizeof [128]i32);
+ fourth := cast([] i32) malloc(sizeof [128]i32);
print(cast(u32) fourth);
- fifth := cast(^i32) alloc(^heap_allocator, sizeof i32);
+ fifth := cast(^i32) malloc(sizeof i32);
print(cast(u32) fifth);
}
\ No newline at end of file
cast->token->pos,
"cannot cast to or from a struct");
WI(WI_DROP);
+ *pcode = code;
return;
}
cast->token->pos,
"cannot cast to a function");
WI(WI_DROP);
+ *pcode = code;
+ return;
+ }
+
+ if (from->kind == Type_Kind_Basic && from->Basic.kind == Basic_Kind_Void) {
+ onyx_message_add(Msg_Type_Literal,
+ cast->token->pos,
+ "cannot cast from void");
+ WI(WI_DROP);
+ *pcode = code;
return;
}
if (to->kind == Type_Kind_Basic && to->Basic.kind == Basic_Kind_Void) {
WI(WI_DROP);
+ *pcode = code;
return;
}