Skip to content

Instantly share code, notes, and snippets.

@od0x0
Created July 18, 2010 14:15
Show Gist options
  • Save od0x0/480433 to your computer and use it in GitHub Desktop.
Save od0x0/480433 to your computer and use it in GitHub Desktop.
import memory/Allocator
printf: extern func(String,...)->Int
Vec3: class{
x, y, z: Float
init: func(=x,=y,=z){}
println: func{
printf("(%f,%f,%f)\n",x,y,z)
}
}
Vec3 setAllocator(Allocator manual)
v3:=Vec3 new(1,0,0)
v3 println()
v3 delete()
newString:=Allocator manual allocate(4) as String
string:="Yes"
for(i in 0..4) newString[i]=string[i]
newString println()
Allocator manual freeMemory(newString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment