"Scott MacMaster" <scott@xxxxxxxxxxxxxxxxxx> wrote: > If an object deletes itself then that applies [sic: implies?] that the > object is the owner of itself. In c++ programs this is never. Thus an > object in c++ should never delete itself. This is wrong. The concept of ownership is not even expressible in C++. So there are no constraints on who can own whom. Certainly an object can own itself. As someone else pointed out, a reference-counted object can be considered self-owning -- and that's a well-known idiom that can even be found in Stroustrop. I created a language where ownership *was* expressed, and was the basis of all memory management. But I never got it fully working well, and in the end I ripped it out and put in a garbage collector. >> This is also why creating objects on >> the stack is incorrect. An automatic (stack) variable can only be >> accessed from the thread that created it. > > That's definitely wrong. I'm certain I've accessed the stack from a > seperate thread. In any case, I decided to run a test program. I > initialized a int to 10 in one thread, later I displayed and changed the > value in another thread, the back in the first thread I displayed the > value again. Everything worked perfectly and as expected. It can be done, but it requires very careful synchronization of the threads. I'd consider it a bad practice.