source: tests/zombies/gc_no_raii/src/gc.h @ fd54fef

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since fd54fef was fd54fef, checked in by Michael Brooks <mlbrooks@…>, 3 years ago

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

  • Property mode set to 100644
File size: 402 bytes
Line 
1#pragma once
2
3#include "gcpointers.h"
4#include "internal/collector.h"
5
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// }
14
15forall(T)
16static inline void gcmalloc(gcpointer(T)* ptr)
17{
18        ptr { gc_allocate(sizeof(T)) };
19        get(ptr) {};
20      gc_conditional_collect();
21}
Note: See TracBrowser for help on using the repository browser.