From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_05,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc243f3bb85ffa4f X-Google-Attributes: gid103376,public From: cosc19z5@Bayou.UH.EDU (Spasmo) Subject: Re: Exceptions: Are they GOTOs? Date: 1996/07/12 Message-ID: <4s4tgs$po6@masala.cc.uh.edu>#1/1 X-Deja-AN: 167942387 references: organization: University of Houston newsgroups: comp.lang.ada Date: 1996-07-12T00:00:00+00:00 List-Id: Bradley Edelman (brad@cs.uwa.oz.au) wrote: : What do people think about exception handling? I believe it to be a major : strength of Ada but there is a school of thought that exceptions are just : GOTO statements and should be avoided accordingly. Well, exceptions IMO do seem to be a bit unstructured in that control is immediately transferred to another block and everything is surpassed so that the possible paths of execution may not be obvious, however I think this is a very small price to pay for such a beautiful way of handling errors. : I think raising an exception is a neater way of handling an error than, say, : returning an error code or status. Full agreement. There are 2 really great things that I love about exceptions. 1) They don't interfere with the regular return mechanisms of subprogram units. This was something that annoyed me to no end in other languages. If I had to account for error returns, I'd have to cram it in with the other parameters or return type of my subprogram which would play havoc with my design, and often convolute things. Furthermore there was another problem which I'll talk about in #2. 2) You can't ignore exceptions, and this is great because you know that if you raise an exception, it WILL be handled. Either the programmer on the other end will handle it, or the system will take over, which will make the programmer realize that there's an important return that he/she should handle. If you returned values from a procedure/function then you had to face the possibility of your error code being ignored. This is especially serious in C/C++ since you can happily ignore the return values from functions entirely, calling them instead as if they were void functions. : I'd appreciate thoughts either way. All I can say is that I *LOVE* Ada's exceptions. Hell, I like a lot about Ada, but this is a thread about exceptions so I won't babble here :) : Thanks, Brad -- Spasmo "Here's a present just for you When you open it, you'll be through" "Letter Bomb" by the Circle Jerks