Re: Go ahead. Stop programming. This ensures you from any mistakes.



valentin tihomirov wrote:
Anyway, RAII dow not address the problem of partially created objects.
Why ? Partially constructed objects will be destroyed partially - if you are using RAII and not plain pointers.

RAII is very powerfull. One of the (only) reasons I still use C++.


How does RAII knows how far the resourse allocation has reached? How does it
> jump to the point in the destructor to free only the allocated
> objects? The

Well I'm not that experienced in compiler technology.
Simplified I would describe it this way:

The compiler holds a list with pointers to the destructors of the created objects and simply calls them in reverse order, if anything goes wrong (exception) or the object is destroyed.

Andre
.