Recommended practise for exceptions specifications?

C

Carsten Fuchs

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
 
R

Rapscallion

Carsten said:
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".
 
B

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
 
C

Carsten Fuchs

ben said:
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
 
R

Ron Natalie

ben said:
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.
 
J

Jerry Coffin

Carsten said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top