Re: Exception Specifications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Perry,

I only use "no throw" specification, i.e., throw(), on functions that
absolutely guarantee that they do not throw.  And I use it sparingly, only
on my functions that really shouldn't throw, ever, such as swap functions,
and I know (a priori) that those functions will never throw.

NOTE:  I have been stung by writing a "no throw" function, annotated with
throw(), and even commented in the contract comments, yet someone later put
in some additional "helpful" tracing/debugging facilities that did throw in
some situations... no joy in Mudville.  Caveat emptor.

I do not put itemized throw specifications on functions.

I highly recommend C++ Coding Standards by Sutter and Alexandrescu, in
particular the section on Error Handling and Exceptions.

Moreso, I highly recommend all of Sutter's books on C++.

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux