Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #1673
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Wed, 30 May 2012 15:00:21 -0500 |
| Date | Wed, 30 May 2012 13:00:25 -0700 |
| From | Patricia Shanahan <pats@acm.org> |
| User-Agent | Mozilla/5.0 (Windows NT 5.2; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 |
| MIME-Version | 1.0 |
| Newsgroups | comp.programming, comp.lang.c++ |
| Subject | Re: Error codes vs. exceptions |
| References | <4f571f71-55ca-4922-b81b-31f954cac855@kw17g2000pbb.googlegroups.com> <jq5o9g$2md$1@dont-email.me> |
| In-Reply-To | <jq5o9g$2md$1@dont-email.me> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <K-CdnZS50KjI4VvSnZ2dnUVZ_o2dnZ2d@earthlink.com> (permalink) |
| Lines | 32 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 70.230.202.8 |
| X-Trace | sv3-oYF7v2lsqFM/RMUPd/ZJsB59CYdDzEEJWc0g3Oh4rNy9/zaOmPy3ANVn7u9gaRCky0QUY4/ywmM2IzM!GRy3ABI2MhtwPGw0DY61Lo3CffAnnebXBlVr2A8mlwfZsEafXWkiOYn3XXvQQnunhA4E4GGKzAuD!prZvrqdyJ7B+bLQj7evJRiZ+dRyAFg1HAkaf7gCJtELU |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2697 |
| Xref | csiph.com comp.programming:1673 comp.lang.c++:16436 |
Cross-posted to 2 groups.
Show key headers only | View raw
On 5/30/2012 11:18 AM, Jeff Flinn wrote: ... > A more appropriate question to ask is: ``do we want stack unwinding > here?'' Because actually handling an exception is likely to be > significantly slower than executing mainline code, you should also ask: > ``Can I afford stack unwinding here?'' For example, a desktop > application performing a long computation might periodically check to > see whether the user had pressed a cancel button. Throwing an exception > could allow the operation to be cancelled gracefully. On the other hand, > it would probably be inappropriate to throw and handle exceptions in the > inner loop of this computation because that could have a significant > performance impact. The guideline mentioned above has a grain of truth > in it: in time critical code, throwing an exception should be the > exception, not the rule." ... *Any* style rule or pattern has a potential for being overridden by important performance concerns. That does not mean we should not ask "What is good style?". I usually prefer exceptions: 1. Exceptions leave the function result available for the natural result. 2. In many languages, exceptions encode more information more directly than is possible with status codes. 3. Exception processing can be grouped at the end of a block of code, with the non-exception flow left clear. Status codes tend to result in interleaving exception handling throughout the main line flow. Patricia
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar
Error codes vs. exceptions mike3 <mike4ty4@yahoo.com> - 2012-05-28 21:15 -0700
Re: Error codes vs. exceptions BGB <cr88192@hotmail.com> - 2012-05-29 00:10 -0500
Re: Error codes vs. exceptions mike3 <mike4ty4@yahoo.com> - 2012-05-28 22:41 -0700
Re: Error codes vs. exceptions BGB <cr88192@hotmail.com> - 2012-05-29 01:34 -0500
Re: Error codes vs. exceptions Adam Skutt <askutt@gmail.com> - 2012-05-29 07:16 -0700
Re: Error codes vs. exceptions BGB <cr88192@hotmail.com> - 2012-05-29 09:45 -0500
Re: Error codes vs. exceptions Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-05-29 09:08 +0200
Re: Error codes vs. exceptions mike3 <mike4ty4@yahoo.com> - 2012-05-31 13:52 -0700
Re: Error codes vs. exceptions Ian Collins <ian-news@hotmail.com> - 2012-06-01 09:08 +1200
Re: Error codes vs. exceptions mike3 <mike4ty4@yahoo.com> - 2012-05-31 22:32 -0700
Re: Error codes vs. exceptions "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-05-29 09:37 +0200
Re: Error codes vs. exceptions "io_x" <a@b.c.invalid> - 2012-05-29 10:00 +0200
Re: Error codes vs. exceptions Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-05-29 12:24 +0000
Re: Error codes vs. exceptions Nobody <nobody@nowhere.com> - 2012-05-30 15:23 +0100
Re: Error codes vs. exceptions BGB <cr88192@hotmail.com> - 2012-05-30 09:40 -0500
Re: Error codes vs. exceptions Adam Skutt <askutt@gmail.com> - 2012-05-30 08:04 -0700
Re: Error codes vs. exceptions BGB <cr88192@hotmail.com> - 2012-05-30 12:01 -0500
Re: Error codes vs. exceptions Jeff Flinn <TriumphSprint2000@hotmail.com> - 2012-05-30 14:18 -0400
Re: Error codes vs. exceptions Patricia Shanahan <pats@acm.org> - 2012-05-30 13:00 -0700
Re: Error codes vs. exceptions Adam Skutt <askutt@gmail.com> - 2012-05-30 21:25 -0700
Re: Error codes vs. exceptions Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-05-30 22:44 -0400
Re: Error codes vs. exceptions Nobody <nobody@nowhere.com> - 2012-05-31 05:04 +0100
Re: Error codes vs. exceptions Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-06-01 21:44 -0400
Re: Error codes vs. exceptions "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-06-02 08:39 +0200
Re: Error codes vs. exceptions BGB <cr88192@hotmail.com> - 2012-06-02 16:31 -0500
Re: Error codes vs. exceptions mike3 <mike4ty4@yahoo.com> - 2012-06-02 15:49 -0700
Re: Error codes vs. exceptions Ian Collins <ian-news@hotmail.com> - 2012-06-03 11:17 +1200
Re: Error codes vs. exceptions Rui Maciel <rui.maciel@gmail.com> - 2012-06-03 16:38 +0100
Re: Error codes vs. exceptions Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-06-03 20:26 -0400
Re: Error codes vs. exceptions gremnebulin <peterdjones@yahoo.com> - 2012-06-20 12:05 -0700
csiph-web