Changeset bee4283 for src/examples/gc_no_raii/src/gcpointers.h
- Timestamp:
- Aug 4, 2016, 9:18:10 AM (6 years ago)
- Branches:
- aaron-thesis, arm-eh, 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, resolv-new, with_gc
- Children:
- 00c32e9, 76e8c55
- Parents:
- aea7168
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/gc_no_raii/src/gcpointers.h
raea7168 rbee4283 10 10 }; 11 11 12 void gcpointer_ctor(gcpointer_t* this);13 void gcpointer_ctor(gcpointer_t* this, void* address);14 void gcpointer_ctor(gcpointer_t* this, gcpointer_t*other);15 void gcpointer_dtor(gcpointer_t* this);16 gcpointer_t* gcpointer_assign(gcpointer_t* this, gcpointer_t*rhs);12 void ?{}(gcpointer_t* this); 13 void ?{}(gcpointer_t* this, void* address); 14 void ?{}(gcpointer_t* this, gcpointer_t other); 15 void ^?{}(gcpointer_t* this); 16 gcpointer_t* ?=?(gcpointer_t this, gcpointer_t rhs); 17 17 18 18 //Logical operators … … 27 27 }; 28 28 29 forall(otype T) 30 static inline void ctor(gcpointer(T)* this) 31 { 32 gcpointer_ctor(&this->internal); 33 } 29 // 30 forall(otype T) void ?{}(gcpointer(T)* this); 31 forall(otype T) void ?{}(gcpointer(T)* this, void* address); 32 forall(otype T) void ctor(gcpointer(T)* this, void* address); 33 forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T)* other); 34 forall(otype T) void ^?{}(gcpointer(T)* this); 35 forall(otype T) gcpointer(T) ?=?(gcpointer(T) this, gcpointer(T) rhs); 34 36 35 // forall(otype T)36 // static inline void ctor(gcpointer(T)* this, int null)37 // {38 // gcpointer_ctor(&this->internal, NULL);39 // }40 37 41 forall(otype T) 42 static inline void ctor(gcpointer(T)* this, void* address) 43 { 44 gcpointer_ctor(&this->internal, address); 45 } 46 47 forall(otype T) 48 static inline void ctor(gcpointer(T)* this, gcpointer(T)* other) 49 { 50 gcpointer_ctor(&this->internal, other); 51 } 52 53 forall(otype T) 54 static inline void dtor(gcpointer(T)* this) 55 { 56 gcpointer_dtor(&this->internal); 57 } 58 59 forall(otype T) 60 static inline gcpointer(T)* ?=?(gcpointer(T)* this, gcpointer(T)* rhs) 61 { 62 gcpointer_assign(&this->internal, &rhs->internal); 63 return this; 64 } 65 66 forall(otype T) 67 static inline T *?(gcpointer(T) this) 68 { 69 return *(T*)this.internal.ptr; 70 } 38 forall(otype T) T *?(gcpointer(T) this); 71 39 72 40 //Logical operators 73 forall(otype T) 74 static inline int ?!=?(gcpointer(T) this, gcpointer(T) rhs) 75 { 76 return this.internal.ptr != rhs.internal.ptr; 77 } 78 79 forall(otype T) 80 static inline int ?==?(gcpointer(T) this, gcpointer(T) rhs) 81 { 82 return !(this == rhs); 83 } 84 85 forall(otype T) 86 extern struct gcpointer(T) 0; 41 forall(otype T) int ?!=?(gcpointer(T) this, gcpointer(T) rhs); 42 forall(otype T) int ?==?(gcpointer(T) this, gcpointer(T) rhs);
Note: See TracChangeset
for help on using the changeset viewer.