A colleague recently asked my opinion on the use of exception specifications in C ++ code, and I was able to redo this article by Herb Sutter: A Pragmatic Look in Exceptional Specifications . The article, like most of Herb Sutter, is an instructional reading, but the short answer is βdon't do this.β
In the summary, he refers to a poem called "Twas the Night Before Implementation," in which, in fact, the standardization committee tends to require users to add a function at the last minute, only to discover that while doing what they asked for it does not do what they want. And yes, the exception specifications are consistent with this account. According to him, "At that time, this function seemed like a good idea, and this is what some asked for." If this is not enough, he then visits the βexportβ with similar sad results.
So, the question is: the "function" of C ++ is broken and should not be used if you do not want to experience tears. This may be a victim of subjective bickering, but I hope that people will give concrete experience when the function was deployed only in order to cause measurable problems. It would be even better to quote articles by leading lights such as Sutter (or someone deeply involved in the Standard) warning people about their function.
source
share