From 3a25d5e22147a9eb3b6efe9dc27f756d2330ff73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Thu, 9 May 2024 16:35:04 -0300 Subject: [PATCH 1/2] Fix array example mut was missing --- examples/arrays.con | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/arrays.con b/examples/arrays.con index 52ade15..1e29aac 100644 --- a/examples/arrays.con +++ b/examples/arrays.con @@ -1,7 +1,7 @@ mod Example { fn main() -> i32 { let mut array: [i32; 4] = [1, 9, 3, 4]; - let nested_array: [[i32; 2]; 2] = [[1, 2], [9, 9]]; + let mut nested_array: [[i32; 2]; 2] = [[1, 2], [9, 9]]; array[1] = 2; nested_array[1] = [3, 4]; From 16fda9f5970654ccbc634733117fa98d547d5e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Thu, 9 May 2024 16:54:51 -0300 Subject: [PATCH 2/2] Use ascii code instead of char casting from char to u8 is not supported --- examples/hello_world_hacky.con | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/hello_world_hacky.con b/examples/hello_world_hacky.con index ed27057..132fe07 100644 --- a/examples/hello_world_hacky.con +++ b/examples/hello_world_hacky.con @@ -6,29 +6,29 @@ mod HelloWorld { let origin: *mut u8 = malloc(12); let mut p: *mut u8 = origin; - *p = 'H'; + *p = 72; p = p + 1; - *p = 'e'; + *p = 101; p = p + 1; - *p = 'l'; + *p = 108; p = p + 1; - *p = 'l'; + *p = 108; p = p + 1; - *p = 'o'; + *p = 111; p = p + 1; - *p = ' '; + *p = 32; p = p + 1; - *p = 'W'; + *p = 87; p = p + 1; - *p = 'o'; + *p = 111; p = p + 1; - *p = 'r'; + *p = 114; p = p + 1; - *p = 'l'; + *p = 108; p = p + 1; - *p = 'd'; + *p = 100; p = p + 1; - *p = '\0'; + *p = 0; puts(origin); return 0;