[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: -fno-exceptions?
From:       Johannes Sixt <Johannes.Sixt () telecom ! at>
Date:       1999-05-28 16:15:30
[Download RAW message or body]

On Thu, 27 May 1999, David Faure wrote:
>On Thu, May 27, 1999 at 08:56:23AM +0200, Mario Weilguni wrote:
>> Can we safely use -fno-exceptions on the core libraries? None of these files
>> uses exceptions, and the binaries are MUCH smaller:
>> kdecore -fexceptions: 1003kb
>> kdecore -fno-exceptions: 582kb
>> 
>> If possible, we should add this as default.
>
>That's ok for kdecore, but I just found out it's not ok for libkded: 
>
>kded-utils.cc says :
>
>	  try {
>	       if( line != QString::null) {
>		    CORBA::Object_var ob = orb->string_to_object( line);
>		    kded = KDED::InitialReferences::_narrow( ob);
>	       }
>	  } catch(...) {
>	       kded = KDED::InitialReferences::_nil();
>	  }

try-catch blocks aren't the only place where exceptions are handled! Each time
you allocate an object with a destructor on the stack (like QStrings),
exceptions are handled implicitly! Which is a Good Thing (TM).

Don't abandon exceptions in libraries, please!!!!!

For those who didn't notice, yet: As of egcs 1.1 operator new throws a bad_alloc
if it cannot allocate enough space! For a program without explicit exception
handling (try-catch-blocks) the net effect is the same as was earlier: program
termination. Except that now CHECK_PTR is unnecessary after a new (won't be
reached).

-- Hannes

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic