Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 65677 invoked from network); 5 Jul 2006 15:38:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2006 15:38:36 -0000 Received: (qmail 33768 invoked by uid 500); 5 Jul 2006 15:38:36 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 33752 invoked by uid 500); 5 Jul 2006 15:38:36 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 33741 invoked by uid 99); 5 Jul 2006 15:38:36 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 08:38:36 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of AntonP@moscow.vdiweb.com designates 195.210.189.132 as permitted sender) Received: from [195.210.189.132] (HELO mail.moscow.vdiweb.com) (195.210.189.132) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 08:38:32 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: svn commit: r418319 - /incubator/stdcxx/trunk/tests/strings/21.string.io.cpp Date: Wed, 5 Jul 2006 19:38:19 +0400 Message-ID: <4D6A8407B7AC6F4D95B0E55C4E7C4C62047CFF32@exmsk.moscow.vdiweb.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: svn commit: r418319 - /incubator/stdcxx/trunk/tests/strings/21.string.io.cpp Thread-Index: AcafyBZrrptFURSHQJOxY36p2BQ9YwAeZ2TQ From: "Anton Pevtsov" To: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Martin Sebor wrote: > In fact, we might want to have a single throw function, say rw_throw(ExceptionId id, const > char* file, int line, const char *function, const char *format, ...) to throw a particular exception from a test driver's class or function. That way we would have a single point of throwing an > exception in the whole test driver which is useful for setting breakpoints and to reduce code duplication. I am working on this. I suggest to implement this function in a separate header (say rw_exception.h). Also I implemented the exception safety loop in 21.string.io in the same to other tests way but faced with a perfomance problem. The streambuf virtual functions for long strings (say "x@4096") are called very often and as a result the test is performed very slowly. I suggest to reduce the thrown exception count to 3 or 5 for the long strings (throw on first and last elements and on several in the middle) and leave this count unchanged for short strings (the streambuf will throw on each element). What do you think about this? Thanks, Anton Pevtsov -----Original Message----- From: Martin Sebor [mailto:sebor@roguewave.com]=20 Sent: Wednesday, July 05, 2006 04:15 To: stdcxx-dev@incubator.apache.org Subject: Re: svn commit: r418319 - /incubator/stdcxx/trunk/tests/strings/21.string.io.cpp Anton Pevtsov wrote: > Martin, I have a question about the exceptions thrown from the=20 > streambuf virtual functions. The standard says (27.5.2.4.3 p1) that=20 > "underflow or uflow might fail by throwing exception prematurely" but=20 > the exception type is not specified. Yes, the streambuf virtual function can throw an exception of any type (since it can be overridden by the user). For example, it can throw bad_alloc if the function fails to allocate memory, or it can throw some user-defined exception type for some network error. > Shall we throw something just to verify the > exception safety or shall we throw some specific exception? The type of the object doesn't really matter, just as long as it's distinguishable from the types that can be thrown by the library itself. I.e., we shouldn't throw std::bad_alloc, std::ios::failure, or any other type based on std::exception. The enumeration value thrown by the MyStreambuf class is probably okay, but we could throw something more sophisticated, e.g., an object akin to the BadSharedAlloc class thrown by SharedAlloc. In fact, we might want to have a single throw function, say rw_throw(ExceptionId id, const char* file, int line, const char *function, const char *format, ...) to throw a particular exception from a test driver's class or function. That way we would have a single point of throwing an exception in the whole test driver which is useful for setting breakpoints and to reduce code duplication. Martin