473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Recommended practise for exceptions specifications?

Hello all,

what please is the recommended (most future-safe, standard-compliant
etc.) practise for exception specifications?

I did some googling, and the trend seemed to be "don't use exception
specifications at all". Well, I was wondering if this is still valid, or
if there are newer trends in the standard that (partially) solve the
related problems.

Thank you very much.

Best regards,
Carsten

--
Ca3D - Engine http://www.Ca3D-Engine.de
Carsten Fuchs http://www.Ca3D-Engine.de/c_Carsten.php
Jul 23 '05 #1
5 1423
Carsten Fuchs wrote:
what please is the recommended (most future-safe, standard-compliant
etc.) practise for exception specifications?

I did some googling, and the trend seemed to be "don't use exception
specifications at all". Well, I was wondering if this is still valid, or if there are newer trends in the standard that (partially) solve the
related problems.


Also read the respective chapters in Stroustrup's "The C++ Programming
Language".

Jul 23 '05 #2
ben
exception specification is not an easy task for compiler writers so most
compilers are shipped without that feature compliant to the standard. Read
your compiler documentation.

ben

"Carsten Fuchs" <Ca**********@T-Online.de> wrote in message
news:42***********************@newsread4.arcor-online.net...
Hello all,

what please is the recommended (most future-safe, standard-compliant
etc.) practise for exception specifications?

I did some googling, and the trend seemed to be "don't use exception
specifications at all". Well, I was wondering if this is still valid, or
if there are newer trends in the standard that (partially) solve the
related problems.

Thank you very much.

Best regards,
Carsten

--
Ca3D - Engine http://www.Ca3D-Engine.de
Carsten Fuchs http://www.Ca3D-Engine.de/c_Carsten.php

Jul 23 '05 #3
ben wrote:
Read your compiler documentation.


I have, that is the very problem: I want portable, compiler-independent
code. That is also the reason why I posted here rather than in a
compiler-specific group.

Best,
Carsten

--
Ca3D - Engine http://www.Ca3D-Engine.de
Carsten Fuchs http://www.Ca3D-Engine.de/c_Carsten.php
Jul 23 '05 #4
ben wrote:
exception specification is not an easy task for compiler writers so most
compilers are shipped without that feature compliant to the standard. Read
your compiler documentation.

Even when they are compliant with the standard, the feature is by
and large, useless.
Jul 23 '05 #5
Carsten Fuchs wrote:
Hello all,

what please is the recommended (most future-safe, standard-compliant
etc.) practise for exception specifications?

I did some googling, and the trend seemed to be "don't use exception
specifications at all".
That's still pretty much the case.
Well, I was wondering if this is still valid, or
if there are newer trends in the standard that (partially) solve the
related problems.


There are some compilers that can optimize some code if you use an
empty exception specification, and based on that a few people recommend
that particular use in limited circumstances. IMO, this is rarely
really justified. From what I've seen so far, it's usually quite a bit
of work for a fairly minor optimization, and a fair amount of potential
for problems as well.

IOW, I'm still fairly firmly in the "don't use them" camp, but it seems
only fair to say that there is another camp out there, and even if you
don't hear from any of them directly, you should be aware that there's
_some_ difference of opinion on the subject.

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Michael Hill | last post by:
Hi, folks. I am wondering what the HTML standard says regarding the headings specifiers (h1, h2, h3, etc.). Specifically, I would like to know if these tags have the browser include a blank line...
10
by: Brian Folke Seaberg | last post by:
I was recently browsing a couple of C++ books at the local bookstore. One book called throwing exceptions from constructors a "dubious practice." Another book recommended not throwing...
11
by: C# Learner | last post by:
What type of exception should I throw when my code detects that a connection has dropped (i.e. NetworkStream.Read() returns 0)? Should I just throw a SocketException or should I create my own...
5
by: Gerard | last post by:
Hi, Is it an option/idea to make the exceptions thrown be part of the signature of a function? - So I'll get a warning if I call a function and not handle one of the exceptions. - So I'll get...
41
by: Stuart Golodetz | last post by:
Hi all, Just wondering whether there's any reason why exception specifications are enforced at runtime, rather than at compile-time like in Java? (This was prompted by reading an article on...
4
by: a_agaga | last post by:
Hi! Do you know different alternatives to convert exceptions in many methods of some wrapper classes. User -Wrapper classes -LibraryClasses -... Wrapper classes catch an exception of only...
42
by: Jon Harrop | last post by:
Why are exceptions in C++ ~6x slower than exceptions in OCaml? -- Dr Jon D Harrop, Flying Frog Consultancy Objective CAML for Scientists...
12
by: Ioannis Vranos | last post by:
Perhaps a mechanism can be introduced in the C++0x/1x standard, something simple like defining a function as: void somefunc(void) throw() { // ... }
4
by: Slaunger | last post by:
Hi there, I am a newcomer to Pyhton coming from Java working on a relatively large Pyhton project with several packages and modules. To improve exception handling I would like to introduce some...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.