From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Alf P. Steinbach" Newsgroups: gmane.emacs.help Subject: Re: How to exit out of a function ? what is try-catch-throw in terms of Program Counter Date: Mon, 03 Dec 2007 00:51:52 +0100 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <13l6h51o2t0eu49@corp.supernews.com> References: <1192913158.922454.108100@k35g2000prh.googlegroups.com> <13hl1rug786p1f2@corp.supernews.com> <13it94l8vrcqfac@corp.supernews.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1196642430 12633 80.91.229.12 (3 Dec 2007 00:40:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Dec 2007 00:40:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 03 01:40:38 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IyzMU-0004SB-3o for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Dec 2007 01:40:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IyzMD-0001mQ-MV for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Dec 2007 19:40:21 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!sn-xt-sjc-03!sn-xt-sjc-07!sn-post-sjc-02!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.lang.c,comp.lang.c++ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051201 Thunderbird/1.5 Mnenhy/0.7.3.0 In-Reply-To: Original-X-Complaints-To: abuse@supernews.com Original-Lines: 58 Original-Xref: shelby.stanford.edu gnu.emacs.help:154357 comp.lang.c:835394 comp.lang.c++:959428 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49786 Archived-At: * David Thompson: > On Mon, 05 Nov 2007 06:07:25 +0100, "Alf P. Steinbach" > wrote: > >> * David Thompson: >>> On Sun, 21 Oct 2007 00:55:53 +0200, "Alf P. Steinbach" >>> wrote: > >>>> The closest equivalent in C would be a 'longjmp'. However, a C++ >>>> exception is more limited, in that it will only jump up the call chain, >>> C longjmp/setjmp also is only guaranteed to work up the stack; the >>> fact that _some_ implementations can work cross-stack and in >>> particular cross-thread is not standard nor portable. >> So? >> >> But also, what on Earth do you mean by a cross-thread longjmp? I >> implemented coroutines in terms of longjmp at the time that was popular, >> so the concepts involved are not unfamiliar to me. Yet I fail to >> envision what you could be talking about, especially as "fact". I think > > IME 'coroutine' has been used for several slightly different concepts, > but if you mean the one of separate threads of control passing CPU > ownership often along with data anytime they choose, also known more > specifically as cooperative/nonpreemptive threading/tasking, yes. I > think you are agreeing that it did actually work, because 'restoring' > PC and SP (or equivalents) was enough; but I am pointing out it wasn't > and isn't _required_ to work that way. > >> perhaps you're talking about restoring the full context (registers etc) >> of a moment in a thread's execution? >> > IME a cooperative switch itself doesn't need to save and restore other > state, as the language mechanism(s) e.g. 'call yield' handle it. Or > for cache-y things it happens automatically, or mostly automatically. Sorry, I fail to see the point, whatever it is. But regarding definition of 'coroutine', it really doesn't map to more than one concept. Coroutines are treated in Knuth's TAOCPM, which locked in the terminology (although Knuth didn't always succeed in in establishing convention, e.g. he had to redraw his trees because he at first did them with the root down, while the rest of the CS community chose root up, and same for his misconception of "real time" as "reel time", he couldn't make that stick either :-) ); some languages, notably Modula-2, had built-in support for coroutines; you can find some dicussion of coroutines at . Cheers, & hth., - Alf -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?