diff options
| author | Tyge Lovset <[email protected]> | 2021-09-20 10:36:25 +0200 |
|---|---|---|
| committer | Tyge Lovset <[email protected]> | 2021-09-20 10:36:25 +0200 |
| commit | 0861391b9b3b8ad37e24b0dba7da192f31e48a6b (patch) | |
| tree | df78821e47690e1793465d0fcf3d068ad33ccf44 /examples/sharedptr.c | |
| parent | 625a0fad0c1d187d56d3a9c9bb831987e9250e86 (diff) | |
| download | STC-modified-0861391b9b3b8ad37e24b0dba7da192f31e48a6b.tar.gz STC-modified-0861391b9b3b8ad37e24b0dba7da192f31e48a6b.zip | |
Renamed macros: breaking changes for Version 2.0!
c_forvar => c_autovar
c_forscope => c_autoscope
c_forauto => c_auto
Removed: c_fordefer(x); use c_forscope(0, x) instead.
Added: c_exitauto; // continue
Diffstat (limited to 'examples/sharedptr.c')
| -rw-r--r-- | examples/sharedptr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/sharedptr.c b/examples/sharedptr.c index a45e19bc..4d28e1c1 100644 --- a/examples/sharedptr.c +++ b/examples/sharedptr.c @@ -16,8 +16,8 @@ void int_del(int* x) { int main()
{
- c_forauto (cvec_int, vec) // declare and init vec, call del at scope exit
- c_forauto (csset_int, set) // declare and init set, call del at scope exit
+ c_auto (cvec_int, vec) // declare and init vec, call del at scope exit
+ c_auto (csset_int, set) // declare and init set, call del at scope exit
{
cvec_int_push_back(&vec, csptr_int_make(2021));
cvec_int_push_back(&vec, csptr_int_make(2012));
@@ -43,7 +43,7 @@ int main() printf("\nset:");
c_foreach (i, csset_int, set) printf(" %d", *i.ref->get);
- c_forvar (csptr_int p = csptr_int_clone(vec.data[0]), csptr_int_del(&p)) {
+ c_autovar (csptr_int p = csptr_int_clone(vec.data[0]), csptr_int_del(&p)) {
printf("\n%d is now owned by %zu objects\n", *p.get, *p.use_count);
}
|
