source: src/examples/gc_no_raii/src/gc.h @ 00c32e9

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 00c32e9 was bee4283, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

GC files now compile, still working on a compiling example

  • Property mode set to 100644
File size: 289 bytes
Line 
1#pragma once
2
3#include "gcpointers.h"
4#include "internal/collector.h"
5
6forall(otype T)
7static inline gcpointer(T) gcmalloc()
8{
9    gcpointer(T) ptr;
10    void* address = gc_allocate(sizeof(T));
11    (&ptr){ address };
12    ctor(&ptr, address);
13    gc_conditional_collect();
14    return ptr;
15}
Note: See TracBrowser for help on using the repository browser.