diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-06-25 19:41:07 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-06-25 19:41:07 +0100 |
| commit | 15dbea6899fd1e918f4ea0dc91045e0dc460657e (patch) | |
| tree | fcab772d248079a5cceffc47ccf84bb928809670 /code | |
| parent | c4081393c1ca0b1c259cdba572b32c266bc53c5c (diff) | |
Generic procedures generate types on use
Diffstat (limited to 'code')
| -rw-r--r-- | code/demo.odin | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/code/demo.odin b/code/demo.odin index a2d888a09..962b25db1 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -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); +*/ } |