Re: Re: Exceptions creating Exceptional Problems!

Mayank Jain <[email protected]> Sun, 9 Jan 2005 16:58:42 -0500
Newsgroups gmane.user-groups.linux.delhi.devel
Message-ID <[email protected]>
Hi,
I got ur point.

On Sun, 9 Jan 2005 20:59:29 +0530, Abhijit Menon-Sen <[email protected]> wrote:
> "Work-arounds"? You seem to think this is some kind of bug. It is not.
> If you want a variable to be visible in both an inner and outer scope,
> it must be declared in the outer scope.
> 
>     Socket s;
>     try {
>         s.foo();
>     }
>     catch (Error e) {
>         s.bar();
>     }
> 
> Of course, if it is the constructor that's throwing an exception, what
> do you hope to do with the "object" when you catch that exception? It
> won't be an object, and you can't expect to be able to use it at all.
> 
> -- ams

I think, this shall work now,

Socket *s;
try
{
  s=new Socket(args);
  s->do_something();
}
catch(...)
{
  s->what_happened();
}


:-)
thanks
makuchaku

---
http://makuchaku.blogspot.com
#gnutech [at] nl.chatjunkies.org
---
Linux... Life... Freedom...