source: src/examples/gc_no_raii/src/gc.h @ bee4283

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since bee4283 was bee4283, checked in by Thierry Delisle <tdelisle@…>, 6 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.