G
George2
Hello everyone,
Through my testing and study of RAII (Resource Acquisition Is
Initialization) pattern, I think it can solve resource release issue
in the following two situations,
1. Local function object (on stack);
2. Object (either on heap or stack) pointer by auto_ptr;
But it has the limitation that the object pointed by a normal pointer
and allocated on heap (using new or new[]) can not be automatically
released, either the function returns normally or during exception
stack unwinding. Is that correct?
thanks in advance,
George
Through my testing and study of RAII (Resource Acquisition Is
Initialization) pattern, I think it can solve resource release issue
in the following two situations,
1. Local function object (on stack);
2. Object (either on heap or stack) pointer by auto_ptr;
But it has the limitation that the object pointed by a normal pointer
and allocated on heap (using new or new[]) can not be automatically
released, either the function returns normally or during exception
stack unwinding. Is that correct?
thanks in advance,
George