Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The ‘cleanup’ variable attribute¹:

  __attribute__((cleanup(cleanup_function)))
It allows you to create, in essence, destructors for pure C code.

1. https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Common-Variabl...




That is GCC C, not ISO C. Not pure at all.


I meant “pure C” as in “without using C++ or Objective C”.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: