Mail Archives: djgpp/1999/04/11/21:07:56
try is part of C exception handling... I never use it myself, but I've seen
it covered intesively in a book Jamsa's C/C++ Programmer's Bible.
Basically, try initiates an excpetion handler, and some other code
(function, child programs, etc.) can call a throw statement (and exception),
and the exception is caught by the the catch statement in the try block:
try {
printf ( "Some text\n" );
throw;
printf ( "You'll never see this text\n" );
} catch {
printf ( "Exception caught\n" );
}
It has many various uses, but I've never used them for anything that I
couldn't write much more specific code for... the only REALLY good use I can
think of is catching excpeption in child programs.
Sean Middleditch
of
AwesomePlay Productions
http://members.xoom.com/aweplay
aweplay AT iname DOT com
----- Original Message -----
From: Thomas J. Hruska <shinelight AT detroit DOT crosswinds DOT net>
Newsgroups: comp.os.msdos.djgpp
To: <djgpp AT delorie DOT com>
Sent: Sunday, April 11, 1999 5:15 PM
Subject: Undocumented Keyword...
> As I was writing a program, I accidentally came across the following
keyword:
>
> try
>
> I checked to see if there was help available on this keyword in both
> RHIDE's docs and also to see if Borland Turbo C/C++ v3.1 had the same
> keyword. Both IDEs have the same keyword, but neither have documentation
> on it. I searched my C/C++ books for such a keyword and I can't find
> anything.
>
> Is this just a bug? If not, what does 'try' do? I can't figure this out.
> I will check one other IDE tomorrow (Monday) to see if the same thing
> happens in a later version of Borland C/C++ (4.5, I think).
>
>
> Thomas J. Hruska -- shinelight AT detroit DOT crosswinds DOT net
> Shining Light Productions -- "Meeting the needs of fellow programmers"
> http://www.geocities.com/SiliconValley/Heights/8504
> http://click-on.to/shinelight
>
>
- Raw text -