new as a user-level procedure
This commit is contained in:
1 parent
4e7150b470
commit
3ab481df17
5 files changed
+13
-8
No files matched your search
+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