Changeset bee4283 for src/examples/gc_no_raii/test
- Timestamp:
- Aug 4, 2016, 9:18:10 AM (7 years ago)
- 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:
- 00c32e9, 76e8c55
- Parents:
- aea7168
- Location:
- src/examples/gc_no_raii/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/gc_no_raii/test/badlll.c
raea7168 rbee4283 7 7 }; 8 8 9 void ?{}(List_t* this); 10 List_t* ?=?(List_t* this, List_t* rhs); 11 9 12 typedef gcpointer(List_t) LLL; 10 13 11 14 #define MAX (1024 * 1024) 12 15 13 LLL buildLLL(int sz) 16 // LLL buildLLL(int sz) 17 void bla() 14 18 { 15 19 int i; 16 LLL ll0, lll, llc;17 18 ll0 = gcmalloc();19 ll0->val = 0;20 lll = ll0;21 22 for (i = 1; i < sz; i++)23 {24 llc = gcmalloc();25 llc->val = i;26 lll->next = llc;27 lll = llc;28 }29 30 return ll0;20 // LLL ll0;//, lll, llc; 21 // 22 // ll0 = gcmalloc(); 23 // ll0->val = 0; 24 // lll = ll0; 25 // 26 // for (i = 1; i < sz; i++) 27 // { 28 // llc = gcmalloc(); 29 // llc->val = i; 30 // lll->next = llc; 31 // lll = llc; 32 // } 33 // 34 // return ll0; 31 35 } 32 33 void testLLL(LLL lll)34 {35 unsigned char *counted;36 37 counted = (unsigned char *) calloc(MAX, sizeof(unsigned char));38 while (lll)39 {40 counted[lll->val]++;41 if (counted[lll->val] > 1)42 {43 fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val);44 exit(1);45 }46 lll = lll->next;47 }48 49 return;50 }36 // 37 // void testLLL(LLL lll) 38 // { 39 // unsigned char *counted; 40 // 41 // counted = (unsigned char *) calloc(MAX, sizeof(unsigned char)); 42 // while (lll) 43 // { 44 // counted[lll->val]++; 45 // if (counted[lll->val] > 1) 46 // { 47 // fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val); 48 // exit(1); 49 // } 50 // lll = lll->next; 51 // } 52 // 53 // return; 54 // } 51 55 52 56 int main(void) … … 54 58 LLL mylll; 55 59 56 mylll = buildLLL(MAX);57 58 testLLL(mylll);60 // mylll = buildLLL(MAX); 61 // 62 // testLLL(mylll); 59 63 60 64 return 0; -
src/examples/gc_no_raii/test/gctest.c
raea7168 rbee4283 7 7 int main() { 8 8 sout | "Bonjour au monde!\n"; 9 10 gcpointer(int) anInt = gcmalloc(); 9 11 }
Note: See TracChangeset
for help on using the changeset viewer.