mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
14 lines
235 B
Perl
14 lines
235 B
Perl
local c = terralib.includec("stdlib.h")
|
|
|
|
new = macro(function(typquote)
|
|
local typ = typquote:astype()
|
|
return `[&typ](c.malloc(sizeof(typ)))
|
|
end)
|
|
|
|
local typ = int
|
|
terra doit()
|
|
var a : &int = new(int)
|
|
return a
|
|
end
|
|
|
|
doit() |