(This seems to be appropriate for this thread, rather than creating a new one. Apologies if I'm mistaken.)
I'm thinking about binding SDL (and managing unmanaged resources in general), and I noticed something that @eskimo said a few years ago:
I don't understand why having a Window
class that has an SDL_Window
pointer that's constructed in init
and destroyed in deinit
would be problematic. If I look at the documentation on ARC, it seems like the semantics are exactly what I'm expecting -- once all the classes are gone (setting aside the process exit case) the deinit
would be called.
And in this thread, people suggest using non-Copyable types, which is fine but I'd like to understand why using a class here would be a problem, because it's not obvious to me. I especially don't understand why the unmanaged resource would need a retain/release mechanism to be modelled as a class.