From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: abhy Newsgroups: gmane.emacs.help Subject: Re: How to exit out of a function ? what is try-catch-throw in terms of Program Counter Date: Sun, 21 Oct 2007 09:07:33 -0700 Organization: http://groups.google.com Message-ID: <1192982853.186915.270360@y27g2000pre.googlegroups.com> References: <1192913158.922454.108100@k35g2000prh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: ger.gmane.org 1192994975 8951 80.91.229.12 (21 Oct 2007 19:29:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Oct 2007 19:29:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 21 21:29:35 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 1IjgUP-0004eX-Cb for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Oct 2007 21:29:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IjgUH-0000V6-MZ for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Oct 2007 15:29:25 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!y27g2000pre.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.lang.c,comp.lang.c++ Original-Lines: 51 Original-NNTP-Posting-Host: 164.164.104.179 Original-X-Trace: posting.google.com 1192982853 14275 127.0.0.1 (21 Oct 2007 16:07:33 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sun, 21 Oct 2007 16:07:33 +0000 (UTC) In-Reply-To: <1192913158.922454.108100@k35g2000prh.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 box.company.com:8080 (squid/2.6.STABLE5) Complaints-To: groups-abuse@google.com Injection-Info: y27g2000pre.googlegroups.com; posting-host=164.164.104.179; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Original-Xref: shelby.stanford.edu gnu.emacs.help:153169 comp.lang.c:827848 comp.lang.c++:954275 X-Mailman-Approved-At: Sun, 21 Oct 2007 15:27:43 -0400 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:48676 Archived-At: On Oct 21, 1:45 am, gnuist...@gmail.com wrote: > I have some code like this: > > (if (test) > (exit) > (do something)) > > or > > (if (test) > ( do something) > (exit)) > > Various levels of nestings. > > I have several questions, basic to sophisticated. > > (1) What is the lisp equivalent idiom for (exit) as in bash or > in C. > (2) What is the best practice to handle this kind of problems? > > (3) What is the intermediate practice to handle this kind of > problems. > > NOTE: I am really afraid of try-catch-throw. I have never been > able to understand it since it does not exist in C and I cant > really visualize the construct in terms of C. That is what my > brain can process. If you understand it so well, you can show > me how one would really implement that kind of construct in > C and then by extension I can see that kind of program flow > in LISP. Whether its imperative programming or functional, > beneath there is program counter and assembly. C is close > to machine so much that it is almost assembly. So understanding try-c- > t in C is equivalent to understanding at > the level of machine language. > > I therefore take the liberty to crosspost in C and C++ groups. ok i guess we coudl write this one like as below. if(test) do something else exit does this solve u r problem..? If u want to exit from program exit is the keyword..if u want to break from loops break is the key word.