2
0

destructor.c 418 B

123456789101112131415161718192021
  1. #include <stdio.h>
  2. __attribute__((destructor))
  3. void destructor_no_priority(void) {
  4. puts("destructor (no priority)");
  5. }
  6. #define TEST(__priority) \
  7. __attribute__((destructor(__priority))) \
  8. void destructor_priority_##__priority(void) { \
  9. puts("destructor ("#__priority")"); \
  10. }
  11. TEST(101)
  12. TEST(102)
  13. TEST(103)
  14. TEST(104)
  15. int main(void) {
  16. puts("main");
  17. }