Last change
on this file since 06ecda9 was
cfbc56ec,
checked in by Michael Brooks <mlbrooks@…>, 10 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:
624 bytes
|
Rev | Line | |
---|
[cfbc56ec] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2023 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
| 7 | // array-raii-cfa.cfa -- checks RAII on CFA arrays of initialized elements |
---|
| 8 | // |
---|
| 9 | // Author : Mike Brooks |
---|
| 10 | // Created On : Fri Sep 22 15:00:00 2023 |
---|
| 11 | // Last Modified By : |
---|
| 12 | // Last Modified On : |
---|
| 13 | // Update Count : |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | // CFA array means like `array(float, 17) x;` |
---|
| 17 | |
---|
| 18 | #include <collections/array.hfa> |
---|
| 19 | |
---|
| 20 | #define ADECL1(X, El, N) array(El, N) X; |
---|
| 21 | #define ADECL2(X, El, M, N) array(El, M, N) X; |
---|
| 22 | |
---|
| 23 | #include "array-raii.hfa" |
---|
Note: See
TracBrowser
for help on using the repository browser.