[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [?] egcs increases C++ binary size dramatically



On Wed, Apr 08, 1998 at 02:58:39PM +0300, Amos Shapira wrote:
> On Wed, Apr 08, 1998 at 01:01:46AM +0200, Marcus Brinkmann wrote:
> > However, you can give the compiler a hint that a function does not throw any
> > exceptions by adding throw() at the right place:
> > 
> > class ABC {
> >   ABC (int theInt) throw();
> > }
> 
> Shouldn't the compiler still handle eceptions in functions which call
> functions which throw exceptions?

The compiler will abort() if an exception is not caught. I don't know if the
exception handling code is in the function that calls or in the function
that is called. Note that I'm not at all sure if the above code will lead to
shorter code, as it is mostly for compile-time checking etc. Violations
against the above declaration are possible and in large complex programs
unavoidable.
 
> If so, this probably means that you should have exceptions handled in
> any binary which uses a function which throws exceptions (e.g. almost
> any STL container).

Exception handling is a powerful feature, and makes other global error
strategies mostly unnecessary. Therefore the size of compiled and well
written C++ programs will not be larger than an equivalent C program. *And*
the source code will be much cleaner, as you don't have to nest if()
statements or such things.

Voting for Exceptions,
Marcus

-- 
"Rhubarb is no Egyptian god."        Debian GNU/Linux        finger brinkmd@ 
Marcus Brinkmann                   http://www.debian.org    master.debian.org
Marcus.Brinkmann@ruhr-uni-bochum.de                        for public  PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       PGP Key ID 36E7CD09


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: