Article View: comp.std.c++
Article #2560Re: ubiquitous exception specs?
From: Mike Ball
Date: Mon, 13 Nov 1995 17:26
Date: Mon, 13 Nov 1995 17:26
34 lines
1951 bytes
1951 bytes
In article 48n@netcom.com, smeyers@netcom.com (Scott Meyers) writes: > There is a small performance penalty to be paid for each exception > specification, because they have to be checked at runtime to be sure > they're not violated. This typically increases code size and decreases > code speed, though the cost of the feature varies from compiler to > compiler. Well, not really. If you can trust them (and you can now) a lot of them can be eliminated at compile time. Also, until the exception is thrown, the cost can be reduced to an entry in a table that doesn't even need to be paged in until the exception is thrown. Of course, some archaic or otherwise brain-damaged OS's don't support efficient exceptions, so they may have problems. :-) > In addition, it's probably not practical to get an exception specification > for every function used in a program, because existing libraries typically > don't have them. That being the case, it will be close to impossible to > guarantee they are never violated. This is certainly true. Also, how do you put them on template functions? Then, what do you do about extern "C" functions? You can put the exception specification on them, but you pretty much have to just trust them. -Mike Ball SunSoft Developer Products. --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<487t8s$lmt@engnews2.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattReferences:
<smeyersDHwpw1.48n@netcom.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt From: ball@Eng.Sun.COM (Mike Ball) Newsgroups: comp.std.c++ Subject: Re: ubiquitous exception specs? Date: 13 Nov 1995 17:26:35 GMT Organization: Sun Microsystems Inc. Approved: matt@physics2.Berkeley.EDU (Matt Austern) Message-ID: <487t8s$lmt@engnews2.Eng.Sun.COM> References: <smeyersDHwpw1.48n@netcom.com> Reply-To: ball@Eng.Sun.COM NNTP-Posting-Host: physics2.berkeley.edu