Skip to content
Failed

Changes

Summary

  1. Enable array RAII and provide uninit(-), a uNoCtor equivalent. (details)
Commit cfbc56ecba6583d7520c7a7a6bf7f4194e8016a0 by mlbrooks
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
The file was addedtests/array-collections/array-raii-c.cfa
The file was addedtests/array-collections/array-raii.hfa
The file was modifiedlibcfa/src/collections/array.hfa
The file was addedlibcfa/src/raii.hfa
The file was addedtests/array-collections/array-raii-cfa.cfa
The file was addedtests/array-collections/.expect/array-raii-cfa.txt
The file was addedtests/array-collections/.expect/array-raii-c.txt
The file was modifiedlibcfa/src/Makefile.am