taeber/cwith
View on GitHub ↗ ★ 18 C
Automatic cleanup in C using with-statements
4 mentions on Hacker News by 1 person: 1 story, 3 comments · first 2020-05-31 · latest 2022-01-17
20082026
-
…\ { \ declare; \ if (( startup )) { \ do { \ block; \ } while(0); \ cleanup; \ } otherwise; \ } [1] https://github.com/taeber/cwith [2] https://github.com/taeber/cwith/blob/master/with.h
comment by taeber · 2022-01-17 · in A simple defer feature for C -
…with (FILE *fp; fp = fopen(path, "wb"); fclose(fp)) { ... } else { perror("Failed to open file"); } https://github.com/taeber/cwith https://news.ycombinator.com/item?id=23370693 edit: formatting
comment by taeber · 2022-01-16 · in A simple defer feature for C -
…construct. Another user was kind enough to even provide an example in their GitHub issue: https://github.com/taeber/cwith/issues/1 .
comment by taeber · 2020-06-01 · in Show HN: Automatic cleanup in C using with-statements -
▲ 28
Show HN: Automatic cleanup in C using with-statementsstory by taeber · 2020-05-31 · 7 comments