in catch block and in try block are different -- there will be a copy. But I
original exception object instance. Any comments?
Here is my code.
"George" <George@discussions.microsoft.com> wrote in message
I am wondering what is the life cycle of the exception object which
reference variable e binded to?
It's guaranteed to exist through the catch clause, but no longer (unless
rethrown, but even then the compiler may choose to make a copy and
destroy the original).
For example, could we bind a global
reference to the exception object referred by e?
Show me the code where you do that. There's simply no syntax for that.
You could take an address of the exeption object, and store it in a
global pointer variable. This would be no different than, say, storing
an address of a local variable there: you just end up with a dangling
pointer as soon as catch clause finishes.
The life cycle of variable e itself should not beyond the bracket,
Right. Except that you probably mean lifetime when you say "life cycle".
With best wishes,
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925