From: Sean Middleditch Date: 2002-02-25T23:09:41+09:00 Subject: Re: Object/Memory Management On Mon, 2002-02-25 at 08:01, Rik Hemsley wrote: > #if Sean Middleditch > > > And what happens when its destructor throws an exception, while you're > > already handling an exception, in a list of objects all needing their > > destructors called, each of which is likely to throw an additional > > exception because of a bad file permission somewhere? > > C++ FAQs: > > Q: Should destructors throw exceptions when they fail? > A: No. > > Q: Should destructors call routines that may throw exceptions? > A: Only if the destructor catches whatever the routines might throw. > > Q: Should resource deallocation primitives signal failure by throwing > an exception? > A: No. Again, my point. Don't rely on complex, failable tasks in destructors. > > > I've found that the majority of applications work best in either very > > low-level, fast code (C) or a very high-level, nice OO language (like > > Ruby). C++ is an attempt to get a mixture of the two, sacrificing here > > and there to try and get the best of both worlds. > > > > I've found that it tends not to work that nicely. Stick with the fast, > > portable C, or make use of a *real* OO language. ~,^ > > I don't like my apps to fail. Ever. I'm still trying to write a Ruby > program that doesn't die in some circumstances due to an exception which > I couldn't catch (the situation is better in 1.7, admittedly.) I'm curious what that problem is? > > Cheers, > Rik > >