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