Files
linguist/samples/Terra/new.t
2016-01-28 11:22:27 +07:00

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()