public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: "Pétur Runólfsson" <peturr02@ru.is>
To: bkoz@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: RE: libstdc++/10132: filebuf destructor throws exceptions
Date: Wed, 23 Apr 2003 08:56:00 -0000	[thread overview]
Message-ID: <20030423085601.14173.qmail@sources.redhat.com> (raw)

The following reply was made to PR libstdc++/10132; it has been noted by GNATS.

From: =?iso-8859-1?Q?P=E9tur_Run=F3lfsson?= <peturr02@ru.is>
To: <bkoz@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	=?iso-8859-1?Q?P=E9tur_Run=F3lfsson?= <peturr02@ru.is>,
	<gcc-gnats@gcc.gnu.org>
Cc:  
Subject: RE: libstdc++/10132: filebuf destructor throws exceptions
Date: Wed, 23 Apr 2003 08:48:52 -0000

 >     This is in violation of 17.4.4.8.
 
 Yes.
 
 >     I'm thinking about adding throw() exception=20
 > specifications to codecvt member funtions. This could be=20
 > considered a tightening of exception specs, which is allowed=20
 > in 17.4.4.8 p1 (although I remember some noise when the=20
 > proposal to add throw() to dtors was suggested.)
 
 This is disallowed by the resolution to DR 119. It won't
 fix the problem either since the destructor calls other
 functions that may throw (use_facet).
 
 > That should=20
 > at least make the locale::facet policy on error reporting=20
 > (22.2 - Standard locale categories p 2) clear, even though it=20
 > won't necessarily remove the issue.
 
 It is clear, facets may throw any exceptions (except from those
 members with throw() specs).
 
 >     To remove it completely, I'd have to do a try around the=20
 > close() call in basic_filebuf::~basic_filebuf(). And what=20
 > should happen in the catch?=20
 
 Probably just clean up and return.
 
 >     I believe the theory of error handling in the design of=20
 > the io classes is that basic_ios/basic_istream/basic_ostream=20
 > throw, catch, and propogate exceptions. The streambuf classes=20
 > just return eof/-1 (showmanyc, pbackfail, seekoff, seekpos)=20
 > or NULL (open, close) to report errors.
 
 See 17.4.4.8 p3. All streambuf/filebuf members except the
 destructor may throw exceptions of any type. Since the
 standard doesn't require streambuf/filebuf members to catch
 exceptions, I would expect them to propagate.
 
 >     The problem is the intersection of std::locale, which can=20
 > throw on construction (locale(const char*), combine) and=20
 > whenever a use_facet is used. Facets, as above, in practice=20
 > use iostate or some other mechanism to report errors.
 
 Some facets do. Others (like codecvt or the *_put facets)
 don't.
 
 > Although, nothing (except exception-saftey paradoxes) keeps=20
 > derived/user-defined classes from doing this.
 
 I believe user-defined facets are allowed to throw anything
 they choose, whenever they choose from those members
 without throw specs, and that the iostream library should
 be prepared to deal with this.
 
 Petur


             reply	other threads:[~2003-04-23  8:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-23  8:56 Pétur Runólfsson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-04-28 16:00 bkoz
2003-04-25 21:56 Pétur Runólfsson
2003-04-25 21:46 Pétur Runólfsson
2003-04-25  0:56 Benjamin Kosnik
2003-04-24 22:26 Benjamin Kosnik
2003-04-24 22:06 Benjamin Kosnik
2003-04-24 18:56 Pétur Runólfsson
2003-04-24  6:06 Benjamin Kosnik
2003-04-24  6:06 Benjamin Kosnik
2003-04-23  3:47 bkoz
2003-04-22  1:08 bkoz
2003-03-18 12:16 peturr02

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030423085601.14173.qmail@sources.redhat.com \
    --to=peturr02@ru.is \
    --cc=bkoz@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).