public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Stelios Xanthakis <sxanth@ceid.upatras.gr>
To: david daney <ddaney@avtrex.com>
Cc: Richard Henderson <rth@redhat.com>, gcc@gcc.gnu.org
Subject: RE: Using EH from C
Date: Sun, 02 May 2004 09:17:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.21.0405021210001.14045-100000@zenon.ceid.upatras.gr> (raw)
In-Reply-To: <69397FFCADEFD94F8D5A0FC0FDBCBBDEF417@avtrex-server.hq.avtrex.com>



On Sat, 1 May 2004, david daney wrote:

> 
> I would setjump and set an attfibute(cleanup(function))
> at the catch point, and then longjump from the cleanup function.
>  

Not a bad idea. Like this?

	if (setjmp (&context)) {
		struct pseudo_object X __attribute__((cleanup(pdtor)));
		X.normal_termination = 0;
		X.ctx = &context;
		/* ... */
		X.normal_termination = 1;
	} else {
	}

And pdtor() will either just return or longjmp to ctx depending
on normal_termination.

There's still a minor cost but I guess it's ok.

Thanks,

Stelios


  reply	other threads:[~2004-05-02  9:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-02  4:39 david daney
2004-05-02  9:17 ` Stelios Xanthakis [this message]
2004-05-03 11:18   ` Stelios Xanthakis
2004-05-03 16:32     ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2004-04-29 12:51 Stelios Xanthakis
2004-04-29 22:46 ` Richard Henderson
2004-04-30  2:35   ` Giovanni Bajo
2004-04-30  3:15     ` Richard Henderson
2004-04-30  3:36       ` Mike Stump
2004-04-30 16:10   ` Stelios Xanthakis
2004-05-01 14:09     ` Stelios Xanthakis
2004-05-01 18:13       ` Richard Henderson
2004-05-02  2:12         ` Stelios Xanthakis

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=Pine.GSO.4.21.0405021210001.14045-100000@zenon.ceid.upatras.gr \
    --to=sxanth@ceid.upatras.gr \
    --cc=ddaney@avtrex.com \
    --cc=gcc@gcc.gnu.org \
    --cc=rth@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).