Add void type

This commit is contained in:
nub31
2025-06-07 21:40:35 +02:00
parent d7b2aafa27
commit 87e708d95c
8 changed files with 190 additions and 188 deletions

View File

@@ -1,13 +1,13 @@
namespace c
extern func printf(fmt: ^u8, ...args: any)
extern func printf(fmt: ^u8, ...args: any): void
extern func getchar(): i32
extern func puts(fmt: ^u8)
extern func malloc(size: i64): ^any
extern func calloc(num: i64, size: i64): ^any
extern func realloc(ptr: ^any, size: i64): ^any
extern func free(ptr: ^any)
extern func malloc(size: i64): ^void
extern func calloc(num: i64, size: i64): ^void
extern func realloc(ptr: ^void, size: i64): ^void
extern func free(ptr: ^void)
extern func sin(x: f64): f64
extern func cos(x: f64): f64

View File

@@ -4,7 +4,7 @@ struct Human {
age: ^u64
}
export func main(args: []^string) {
export func main(args: []^string): i64 {
let x = [3]f64
x[0] = 1
@@ -14,4 +14,6 @@ export func main(args: []^string) {
c::printf("%f\n", x[0])
c::printf("%f\n", x[1])
c::printf("%f\n", x[2])
return 0
}