From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16151 invoked by alias); 29 Nov 2001 20:59:06 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 15547 invoked from network); 29 Nov 2001 20:57:40 -0000 Received: from unknown (HELO toenail.toronto.redhat.com) (216.138.202.10) by hostedprojects.ges.redhat.com with SMTP; 29 Nov 2001 20:57:40 -0000 Received: (from fche@localhost) by toenail.toronto.redhat.com (8.11.6/8.11.6) id fATKvbP23321; Thu, 29 Nov 2001 15:57:37 -0500 X-Authentication-Warning: toenail.toronto.redhat.com: fche set sender to fche@redhat.com using -f To: Joe Buck Cc: max@e-soft.ru (Maxim Dementiev), gcc@gcc.gnu.org Subject: Re: Using throw(): to use or not to use? References: <200111291735.JAA05491@atrus.synopsys.com> Content-Type: text/plain; charset=US-ASCII From: fche@redhat.com (Frank Ch. Eigler) Date: Wed, 21 Nov 2001 23:32:00 -0000 In-Reply-To: <200111291735.JAA05491@atrus.synopsys.com> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) MIME-Version: 1.0 X-SW-Source: 2001-11/txt/msg01080.txt.bz2 Joe Buck writes: : [...] Specififying throw() should, if anything, make it possible to : generate slightly faster code. If the code is instead slower, I'd : call it a bug, [...] Not really. Within the body of a function declared with throw(), the compiler must normally emit *extra* code that asserts that there are no exceptions thrown from it, sort of like this: try { BODY } catch (...) { abort(); } The *caller* of such a function may in turn assume that no exceptions can come back out, so the compiler may (eventually?) optimize based on that. So, specifying throw() allows new optimization opportunities only at the caller. - FChE From mboxrd@z Thu Jan 1 00:00:00 1970 From: fche@redhat.com (Frank Ch. Eigler) To: Joe Buck Cc: max@e-soft.ru (Maxim Dementiev), gcc@gcc.gnu.org Subject: Re: Using throw(): to use or not to use? Date: Thu, 29 Nov 2001 12:59:00 -0000 Message-ID: References: <200111291735.JAA05491@atrus.synopsys.com> X-SW-Source: 2001-11/msg01581.html Message-ID: <20011129125900.avPSCYuFW1iahNSdAtQK62Yte5QSjnDw5Ghpiyp0ZEs@z> Joe Buck writes: : [...] Specififying throw() should, if anything, make it possible to : generate slightly faster code. If the code is instead slower, I'd : call it a bug, [...] Not really. Within the body of a function declared with throw(), the compiler must normally emit *extra* code that asserts that there are no exceptions thrown from it, sort of like this: try { BODY } catch (...) { abort(); } The *caller* of such a function may in turn assume that no exceptions can come back out, so the compiler may (eventually?) optimize based on that. So, specifying throw() allows new optimization opportunities only at the caller. - FChE