Last change
on this file since 075c6d5 was
cfbc56ec,
checked in by Michael Brooks <mlbrooks@…>, 8 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:
583 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-c.cfa -- checks RAII on C 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 | // C array means like `float x[17];`, as used within CFA |
---|
| 17 | |
---|
| 18 | #define ADECL1(X, El, N) El X[N]; |
---|
| 19 | #define ADECL2(X, El, M, N) El X[M][N]; |
---|
| 20 | |
---|
| 21 | #include "array-raii.hfa" |
---|
Note: See
TracBrowser
for help on using the repository browser.