Mail Archives: djgpp/1998/09/08/19:16:56
From: | Endlisnis <s257m AT unb DOT ca>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: help with exceptions
|
Date: | Tue, 08 Sep 1998 18:57:34 -0300
|
Organization: | NBTel Internet
|
Lines: | 50
|
Message-ID: | <35F5A84E.36E7E2BB@unb.ca>
|
References: | <000301bddaf1$9b81f200$1ca531ce AT enterprise-z>
|
NNTP-Posting-Host: | fctnts09c02.nbnet.nb.ca
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Jorge Ivan Meza Martinez wrote:
>
> Hello,
>
> I am new with the C exceptions but not with handling Java exceptions.
>
> How can I use the C Exceptions ?
>
> in Java you put in the catch ( ... ) the exception that you are catching,
> for example, NumberFormatException, etc. But here I see that are catching
> an integer.
I've touched on Java, and I've touched on C++ exceptions but I think I know
this:
In C++ (as in Java) you can throw & catch ANY type of variable:
struct MyError;
void T()
{
int a;
throw a;
}
void U()
{
MyError a;
throw a;
}
main()
{
try {
U(); T();
}
catch(int a) {
cout << a;
}
catch(MyError) {
dosomething();
}
return 0;
}
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT GeoCities DOT com
Endlis AT nbnet DOT nb DOT ca
- Raw text -