Topic: delete this; legal?


Author: andreas@avix.rni.sub.org (Andreas Voss)
Date: Tue, 19 Jul 1994 17:44:32 GMT
Raw View
class X { ... void foo() { delete this; } };

void bar() { X *x = new X; ... x->foo(); }

Is above definition conforming to the standard? Are there compilers,
that can't handle it? Of course, members (functions or data) must not be
accessed after the delete.

Thanks,
 Andreas
--
Andreas Voss   andreas@avix.rni.sub.org
68232 Mannheim   Tel 06251 700063 (work)
Postf 610321   Tel 0621  476895 (home)