mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 05:08:14 +00:00
new as a user-level procedure
This commit is contained in:
+1
-5
@@ -4,11 +4,7 @@ import (
|
||||
|
||||
|
||||
proc main() {
|
||||
proc new_type(T: type) -> ^T {
|
||||
return ^T(alloc(size_of(T), align_of(T)));
|
||||
}
|
||||
|
||||
var ptr = new_type(int);
|
||||
var ptr = new(int);
|
||||
ptr^ = 123;
|
||||
|
||||
fmt.println(ptr^);
|
||||
|
||||
Reference in New Issue
Block a user