Talking idly with a coworker about how you could add cleanup code to an Apple Bl...

@jrose@belkadan.com

Talking idly with a coworker about how you could add cleanup code to an Apple Blocks Extension block from just C code:

  • Use ObjC or C++ for -dealloc/destructors (the correct answer)
  • Maybe __attribute__((cleanup)) on a __block variable would work, maybe it wouldn't
  • Use objc_setAssociatedObject. But with what object, if we can't use Objective-C? A CFData with custom callbacks would do it!