Hacker News new | past | comments | ask | show | jobs | submit login

The "non obvious" part that makes it RAII is simply that the stack variable in question owns another resource besides itself. The stack variable is being used to wrap something else, be it a chunk of memory, a file handle, one or more other dynamically allocated objects, etc. The key in RAII is that when the stack variable wrapper goes out of scope, the wrapped resource (which is in addition to the stack variable) is deallocated, freed, released, etc.



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

Search: