Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!husc6!wjh12!redsox!campbell From: campbell@redsox.bsw.com (Larry Campbell) Newsgroups: comp.lang.c Subject: Re: Functions returning Error codes or actual info Message-ID: <1592@redsox.bsw.com> Date: 14 Sep 90 02:16:32 GMT References: <772@babcock.cerc.wvu.wvnet.edu> <1990Sep11.121531.23065@jarvis.csri.toronto.edu> <285@grapevine.EBay.Sun.COM> <1990Sep12.105622.847@jarvis.csri.toronto.edu> <291@grapevine.EBay.Sun.COM> <1591@redsox.bsw.com> Reply-To: campbell@redsox.bsw.com (Larry Campbell) Organization: The Boston Software Works, Inc. (BSW) Lines: 44 A number of readers have written asking if the exception handling facility I described earlier in this thread is publicly available. It soon will be. Although I designed it nearly two years ago, I didn't get around to implementing it until last month. Our experience with it has been quite good, but has pointed out a few rough spots that I'd like to iron out before publishing it; there are also some more or less gratuitous dependencies on other aspects of our coding environment that most people probably aren't interested in. Once the rough edges are filed off and the uninteresting BSW dependencies are removed, I'll be posting it to alt.sources and comp.sources.misc. It should work with any C compiler that supports setjmp/longjmp; we've used it on VAX/VMS, HP 3000, Wang VS, and PC-DOS with Turbo C. In the meantime, an approach very similar to ours is described in a research report available from the DEC Systems Research Center: *************** SRC Research Report #40 Date: March 21, 1989 "Implementing Exceptions in C." Eric S. Roberts. 13 pages. Author's Abstract Traditionally, C programmers have used specially designated return codes to indicate exception conditions arising during program execution. More modern languages offer alternative mechanisms that integrate exception handling into the control structure. This approach has several advantages over the use of return codes: it increases the likelihood that programming errors will be detected, makes it easier to structure the specification of an abstraction, and improves the readability of the implementation by providing better syntactic separation between handling of conventional and exceptional cases. This paper describes a set of language extensions to support exception handling in C, and a preprocessor-based implementation of those extensions that demonstrates both the feasibility and the portability of this approach. -- Larry Campbell The Boston Software Works, Inc. campbell@redsox.bsw.com 120 Fulton Street wjh12!redsox!campbell Boston, MA 02109