From: Andrew Cagney <ac131313@redhat.com>
To: gdb@sources.redhat.com
Subject: TRY_CATCH()
Date: Thu, 13 Jan 2005 00:09:00 -0000 [thread overview]
Message-ID: <41E5BBE0.8000604@redhat.com> (raw)
Hello,
The exceptions rewrite opens up a key possibility. It's now possible to
define a macro such that:
struct args
{
...
};
do_func (void *data)
{
struct args *args = data;
... do stuff ...;
}
func (...)
{
struct args args;
args... = ...;
struct exception e = catch_exception (..., func, &args, ...)
switch (e.reason)
...
}
can be replaced with the more compact:
func (...)
{
volatile struct exception e;
TRY_CATCH (e)
{
... do stuff ...;
}
switch (e.reason)
...
}
Yes I know macros a bad, m'kay. However, this offers a simple way to
rewrite the code using something more like a real programming languages
try/catch.
Andrew
PS: I recall this being proposed years ago, but the mechanism proposed
at the time had a more cumbersom syntax, from memory something like:
TRY_BEGIN
... do stuff ...
TRY_END;
comments?
Andrew
next reply other threads:[~2005-01-13 0:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-13 0:09 Andrew Cagney [this message]
2005-01-13 19:48 ` TRY_CATCH() Kris Warkentin
2005-01-14 19:29 ` TRY_CATCH() Frank Ch. Eigler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41E5BBE0.8000604@redhat.com \
--to=ac131313@redhat.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox