mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-17 00:24:05 +00:00
Generic procedures generate types on use
This commit is contained in:
@@ -2,7 +2,15 @@ import (
|
||||
"fmt.odin";
|
||||
)
|
||||
|
||||
proc new_type(T: type) -> ^T {
|
||||
return ^T(alloc_align(size_of(T), align_of(T)));
|
||||
}
|
||||
|
||||
proc main() {
|
||||
var ptr = new_type(int);
|
||||
}
|
||||
|
||||
/*
|
||||
let program = "+ + * - /";
|
||||
var accumulator = 0;
|
||||
|
||||
@@ -18,4 +26,5 @@ proc main() {
|
||||
|
||||
fmt.printf("The program \"%s\" calculates the value %d\n",
|
||||
program, accumulator);
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user