(no title)
anal_reactor | 9 days ago
2. Defer is mostly useful for C++ code that needs to interact with C API because these two are fundamentally different. C API usually exposes functions "create_something" and "destroy_something", while the C++ pattern is to have an object that has "create_something" hidden inside its constructor, and "destroy_something" inside its destructor.
ozgrakkurt|9 days ago
For example if I have a ffi function that transfers the ownership of some allocator in the middle of the function.