Content deleted Content added
Don't use a macro in compiler "cleanup" extensions - adds indirection not required to understand the concept |
Mx. Granger (talk | contribs) +wikilinks |
||
Line 129:
RAII only works for resources acquired and released (directly or indirectly) by stack-allocated objects,
where there ''is'' a well-defined static object lifetime.
[[Heap (programming)|Heap]]-allocated objects which themselves acquire and release resources are common in many languages, including C++. RAII depends on heap-based objects to be implicitly or explicitly deleted along all possible execution paths, in order to trigger its resource-releasing destructor (or equivalent).<ref>{{cite news
| title=Exceptional Situations and Program Reliability
| first1=Westley
Line 139:
| issue=2
| year=2008
| url=https://web.eecs.umich.edu/~weimerw/p/weimer-toplas2008.pdf}}</ref>{{rp|8:27}} This can be achieved by using [[smart
In C++, stack unwinding is only guaranteed to occur if the exception is caught somewhere. This is because "If no matching handler is found in a program, the function terminate() is called; whether or not the stack is unwound before this call to terminate() is implementation-defined (15.5.1)." (C++03 standard, §15.3/9).<ref>{{cite web
|