source: tests/array-collections/.expect/array-raii-c.txt @ cfbc56ec

Last change on this file since cfbc56ec was cfbc56ec, checked in by Michael Brooks <mlbrooks@…>, 5 months ago

Enable array RAII and provide uninit(-), a uNoCtor equivalent.

Enable construction/destruction of "new" CFA array elements,
which was previously deactivated to avoid a compiler performance issue.
The enabled RAII steps more carefully around the performance issue.

Provide uninit(-), with tests covering the typical use case:

struct Foo;
void ?{}( Foo & this, int i ) { printf( "ctor at %d\n", i ); }
uninit(Foo) a[10]; no prints
for (i; 10) (a[i]){ i };
prints
array(uninit(Foo), 10) b; no prints
for (i; 10) (b[i]){ i };
prints

  • Property mode set to 100644
File size: 964 bytes
Line 
1=== builtins
2some nonzero
3silly: some nonzero
4=== custom
5 [1]
6ctor 0
7ctor 1
8ctor 2
9ctor 3
10ctor 4
11func 0
12func 1
13func 2
14func 3
15func 4
16dtor 4
17dtor 3
18dtor 2
19dtor 1
20dtor 0
21 [2]
22ctor 0
23ctor 1
24ctor 2
25ctor 3
26ctor 4
27ctor 5
28func 0 at (0, 0)
29func 1 at (0, 1)
30func 2 at (0, 2)
31func 3 at (1, 0)
32func 4 at (1, 1)
33func 5 at (1, 2)
34dtor 5
35dtor 4
36dtor 3
37dtor 2
38dtor 1
39dtor 0
40 [3]
41ctor 0
42ctor 1
43ctor 2
44ctor 3
45ctor 4
46func 0
47func 1
48func 2
49func 3
50func 4
51dtor 4
52dtor 3
53dtor 2
54dtor 1
55dtor 0
56 [4]
57ctor 0
58ctor 1
59ctor 2
60ctor 3
61ctor 4
62func 0
63func 1
64func 2
65func 3
66func 4
67dtor 4
68dtor 3
69dtor 2
70dtor 1
71dtor 0
72=== uninit
73 [1]
74before ctors
75ctor 0
76ctor 999
77ctor 888
78ctor 3
79ctor 4
80func 0
81func 999
82func 888
83func 3
84func 4
85dtor 4
86dtor 3
87dtor 888
88dtor 999
89dtor 0
90 [2]
91before ctors
92ctor 100
93ctor 101
94ctor 102
95ctor 110
96ctor 999
97ctor 888
98func 100 at (0, 0)
99func 101 at (0, 1)
100func 102 at (0, 2)
101func 110 at (1, 0)
102func 999 at (1, 1)
103func 888 at (1, 2)
104dtor 888
105dtor 999
106dtor 110
107dtor 102
108dtor 101
109dtor 100
Note: See TracBrowser for help on using the repository browser.