Path: utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!pacbell!ptsfa!lll-tis!mordor!lll-lcc!pyramid!cbmvax!snark!eric From: eric@snark.UUCP (Eric S. Raymond) Newsgroups: comp.lang.c++ Subject: Re: Proposal for Exceptions for C++ Summary: Your exception syntax considered clunky Message-ID: <22526909:25d6@snark.UUCP> Date: 31 Mar 88 15:42:50 GMT Organization: Thyrsus Enterprises, Malvern PA 19355 Lines: 31 Discussion: <2495@bsu-cs.UUCP> <4194@ihlpf.ATT.COM> In article <8180006@eecs.nwu.edu>, morrison@eecs.nwu.edu (Vance Morrison) writes: >PROPOSAL: [for exception-handling in C] I like the basic idea of a C analogue of LISP throw/catch, but: 1) I'm not clear how this offers more capability than setjmp/longjmp. 2) I think your catch syntax is un-C-like; no other construct in the language makes that kind of link between adjacent statements. I think that making 'catch' an if-like construct would fit C better; i.e instead of > i = j/k; catch { printf("divide by zero error\n"); } I suggest catch { i = j / k; } do { printf("divide by zero error\n"); } I think this is easier to read, and resolves in a more elegant way the syntactic difficulties you've noted. On the positive side, I do believe (from my LISP experience) that this is a suitable 'most primitive' exception-handling mechanism for environments with only a single control thread (for multiple-thread environments you need to support *named* exceptions, because a common global exception-type variable could get fandangoed on). -- Eric S. Raymond (the mad mastermind of TMN-Netnews) UUCP: {{uunet,rutgers,ihnp4}!cbmvax,rutgers!vu-vlsi}!snark!eric Post: 22 South Warren Avenue, Malvern, PA 19355 Phone: (215)-296-5718