Changeset 28e58fd for src/tests/avltree/avl1.c
- Timestamp:
- Aug 25, 2017, 10:38:34 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 800d275
- Parents:
- af08051 (diff), 3eab308c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/avltree/avl1.c
raf08051 r28e58fd 1 1 #include "avl.h" 2 2 // #include "cwrap.h" 3 #include <stdlib> 3 4 4 5 forall(otype K | Comparable(K), otype V) 5 void ?{}(tree(K, V) *t, K key, V value){6 ( &t->key) { key };7 ( &t->value) { value };8 t ->parent = NULL;9 t ->left = NULL;10 t ->right = NULL;11 t ->balance = 0;6 void ?{}(tree(K, V) &t, K key, V value){ 7 (t.key) { key }; 8 (t.value) { value }; 9 t.parent = NULL; 10 t.left = NULL; 11 t.right = NULL; 12 t.balance = 0; 12 13 } 13 14 14 15 forall(otype K, otype V) 15 void ^?{}(tree(K, V) *t){16 delete(t ->left);17 delete(t ->right);18 ^( &t->key){};19 ^( &t->value){};16 void ^?{}(tree(K, V) & t){ 17 delete(t.left); 18 delete(t.right); 19 ^(t.key){}; 20 ^(t.value){}; 20 21 } 21 22 … … 24 25 // infinite loop trying to resolve ... t = malloc(); 25 26 tree(K, V) * t = malloc(sizeof(tree(K,V))); 26 t{ key, value };27 (*t){ key, value }; 27 28 return t; 28 29 }
Note:
See TracChangeset
for help on using the changeset viewer.