OSDN Git Service

2003-12-01 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / docs / html / 17_intro / C++STYLE
index f838b83..90dc879 100644 (file)
@@ -200,7 +200,25 @@ Notable areas of divergence from what may be previous local practice
    For more explanation and examples, see src/globals.cc.  All such
    variables should be contained in that file, for simplicity.
 
-
+15. Exception abstractions
+    Use the exception abstractions found in functexcept.h, which allow
+    C++ programmers to use this library with -fno-exceptions. (Even if
+    that is rarely advisable, it's a necessary evil for backwards
+    compatibility.)
+
+16. Exception error messages
+    All start with the name of the function where the exception is
+    thrown, and then (optional) descriptive text is added. Example:
+
+    __throw_logic_error("basic_string::_S_construct NULL not valid");
+
+    Reason: The verbose terminate handler prints out exception::what(),
+    as well as the typeinfo for the thrown exception. As this is the
+    default terminate handler, by putting location info into the
+    exception string, a very useful error message is printed out for
+    uncaught exceptions. So useful, in fact, that non-programmers can
+    give useful error messages, and programmers can intelligently
+    speculate what went wrong without even using a debugger.
 
 The library currently has a mixture of GNU-C and modern C++ coding
 styles.  The GNU C usages will be combed out gradually.