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

C# has Using. When the block ends the destructor is called.

VB Classic has reference counting and the terminate event is fired when the count goes to zero. So as long as you don't store the reference in a global the terminate event is guaranteed to run when it goes out of scope (so long as you don't have circular references of course).

C++ has Resource acquisition is initialization (RAII)



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

Search: