Doc. No.: X3J16/96-0200 WG21/N1018 Date: November 7, 1996 Project: Programming Language C++ Reply To: Sandra Whitman Digital Equipment Corporation whitman@tle.enet.dec.com Clause 19 (Diagnostics Library) Issues List - Version 3 Revision History Version 1 - May 22, 1996: Distributed in pre-Stockholm mailing. Version 2 - July 15, 1996: Distributed in post-Stockholm mailing. Version 3 - November 7, 1996: Distributed in pre-Hawaii mailing. Introduction This document is a summary of the issues identified in Clause 19. For each issue the status, a short description, and pointers to relevant reflector messages and papers are given. Active Issues ------------------------------------------------------------------------- Work Group: Library Clause 19 Issue Number: 19-002 Title: Derived exception classes in are broken. Sections: 19 Diagnostics Library [lib.diagnostics] Status: active Description: Kevlin Henney in c++std-lib-4925: >As currently specified all the derived exception classes in > are broken. Consider: > > try > { > throw logic_error("undefined behaviour"); > } > catch(logic_error &ex) > { > cerr << ex.what() << endl; > } > >The string passed to logic_error is a temporary that is destroyed as the >stack unwinds. No surprises there, except that the postcondition for all >the exceptions in states > > "Postcondition: what() == what_arg.data()" > >Implying an implementation of > > class logic_error > { > public: > logic_error(const string& what_arg) : ptr(what_arg.data()) {} > virtual const char *what() const { return ptr; } > private: > const char *ptr; > }; > >Clearly (I hope) string content equality rather than pointer equality was >intended: > > "Postcondition: strcmp(what(), what_arg.c_str()) == 0" > >As an aside, it seems that an implementation is not entitled to add any >extra info (eg. "logic_error: " prefix), which in some ways is a shame. Proposed Resolution: Change Postcondition sections in 19.1.1 [lib.logic.error], 19.1.2 [lib.domain.error], 19.1.3 [lib.invalid.argument], 19.1.4 [lib.length.error], 19.1.5 [lib.out.of.range], 19.1.6 [lib.runtime.error], 19.1.7 [lib.range.error], 19.1.8 [lib.overflow.error], 19.1.9 [lib.underflow.error] from: Postcondition: what() == what_arg.data() to: Postcondition: strcmp(what(), what_arg.c_str()) == 0 Requestor: Kevlin Henney, Kevlin@two-sdg.demon.co.uk Owner: Sandra Whitman Emails: c++std-lib-4925. Papers: None. Closed Issues ------------------------------------------------------------------------- Issue Number: 19-001 Title: Use and Treatment of Clause 19 Predefined Exceptions Inconsistent Last Doc.: N0936R1=96-0118R1 Resolution: closed, no action (Stockholm)