> * Vassilii Khachaturov -- Friday 25 November 2005 15:11: > > * whenever an exception object was created on a stack and then thrown > > (thus causing the dtor for that object to fire!), it was replaced > > with a STATIC exception > > The whole thing looks like a solution desperately searching for a > problem. The reasoning for this patch contradicts Stroustrup, who > has several examples of what we are doing in "The C++ programming > language". Maybe it's only because I'm using an older copy (2nd ed.), > but he writes (p. 602, "r.15.2 Throwing an Exception"): > > "A throw-expression initializes a temporary object of the static > type of the operand of throw and uses that temporary to initialize > the appropriately-typed variable named in the handler." > > The throw expression cares for the thrown class to be available > until it reached the handler. No need to spread ugly static > variables everywhere. Our code looks right for me as it is. But > then again, I'm a relative C++ newbie ... :-)
AAARGH. If you had noticed me talking about the problem with JSB and others last 2 weeks, you'd have been able to prevent smth like 2 days of my work (patching and testing). :-) I didn't have a Stroustrup on hand, and several folks around did tell me this is a problem indeed. Thanks for the quote, better later than never. I wonder what compiler was JSB using in his string throwing example, can you please re-read that thread and see if you can find an alternative explanation? I'm sure that some (older) compilers do behave the ugly way I had described in my patch (this was definitely the case in the pre-ANSI-C++ days). If w/o this we're losing some platform (e.g., MSVC-based builds), maybe we should still apply it. (This is the problem of NOT being a C++ newbie --- you forget what's standard these days and what is coming from your habits to circumvent older quirks.) Nevertheless, a lot of things in the patch do make sense --- e.g., even in the light of what you quote, w/o proper copy semantics of the exception object, the things are broken. I can shred the conversion to static from the patch, but I'd like to hear more on whehter we do need the explicit static objects for some older compilers on other platforms. Vassilii _______________________________________________ Flightgear-devel mailing list [email protected] http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
