Ignore:
Timestamp:
Aug 18, 2016, 10:08:31 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
7a5d773
Parents:
926af74
Message:

first basic test for garbage collector now compiles and works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/gc_no_raii/src/gc.h

    r926af74 r6643e72  
    44#include "internal/collector.h"
    55
    6 forall(otype T)
    7 static inline gcpointer(T) gcmalloc()
    8 {
    9     gcpointer(T) ptr = { gc_allocate(sizeof(T)) };
    10     ptr{};
    11     gc_conditional_collect();
    12     return ptr;
    13 }
     6// forall(otype T)
     7// static inline gcpointer(T) gcmalloc()
     8// {
     9//     gcpointer(T) ptr = { gc_allocate(sizeof(T)) };
     10//     ptr{};
     11//     gc_conditional_collect();
     12//     return ptr;
     13// }
    1414
    1515forall(otype T)
    1616static inline void gcmalloc(gcpointer(T)* ptr)
    1717{
    18         ptr{ gc_allocate(sizeof(T)) };
    19       (*ptr){};
     18        ptr { gc_allocate(sizeof(T)) };
     19        get(ptr) {};
    2020      gc_conditional_collect();
    2121}
Note: See TracChangeset for help on using the changeset viewer.