source: src/examples/gc_no_raii/test/badlll.c @ 00c32e9

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 00c32e9 was bee4283, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

GC files now compile, still working on a compiling example

  • Property mode set to 100644
File size: 922 bytes
RevLine 
[9421588a]1#include "gc.h"
2
3struct List_t
4{
5        gcpointer(List_t) next;
6        int val;
7};
[f1e42c1]8
[bee4283]9void ?{}(List_t* this);
10List_t* ?=?(List_t* this, List_t* rhs);
11
[f1e42c1]12typedef gcpointer(List_t) LLL;
13
14#define MAX (1024 * 1024)
15
[bee4283]16// LLL buildLLL(int sz)
17void bla()
[f1e42c1]18{
19        int i;
[bee4283]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;
[bf5a70da]35}
[bee4283]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// }
[bf5a70da]55
56int main(void)
57{
58        LLL mylll;
59
[bee4283]60        // mylll = buildLLL(MAX);
61        //
62        // testLLL(mylll);
[bf5a70da]63
64        return 0;
65}
Note: See TracBrowser for help on using the repository browser.