Expose public garbage collector API for C language
You can now do epic things like this:
puts(_gc(xasprintf("%d", 123)));
The _gc() API is shorthand for _defer() which works like Go's keyword:
const char *s = xasprintf("%d", 123);
_defer(free, s);
puts(s);
Be sure to always use -fno-omit-frame-pointer which makes code fast too.
Enjoy! See also #114
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
// @assume system five nexgen32e abi conformant
|
||||
// @see examples/ctrlc.c
|
||||
// @noreturn
|
||||
gclongjmp:
|
||||
_gclongjmp:
|
||||
.leafprologue
|
||||
.profilable
|
||||
.weak __garbage
|
||||
@@ -57,5 +57,4 @@ gclongjmp:
|
||||
2: pop %rsi
|
||||
pop %rdi
|
||||
jmp 0b
|
||||
.endfn gclongjmp,globl
|
||||
.source __FILE__
|
||||
.endfn _gclongjmp,globl
|
||||
|
||||
Reference in New Issue
Block a user