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

List:       kde-devel
Subject:    Re: C++ exceptions
From:       Thiago Macieira <thiago () kde ! org>
Date:       2005-12-05 17:32:47
Message-ID: 200512051532.55575.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Vladimir Prus wrote:
>1. Add "try/catch" in each of 30 slots
>2. Introduce 30 new function and use heavy template magic, or macros, to
>call those 30 new function from slots with added try/catch.

Let me make it clear: exceptions are not to trasverse KDELibs and Qt code. 
If any of your 30 slots calls a function that may throw an exception, you 
MUST catch it in the slot.

Allowing the exception to reach the Qt signal/slot mechanism is bound to 
fail and, quite possibly, core dump.

>An ideal solution would be to have some base KException class, and a
> signal KApplication::onException(KException&) that I can connect to for
> error reporting. But implementing that would require lots of try/catch
> inside kdelibs, so I'm not sure that's workable.

I don't think exception handling in kdelibs code is something you can 
expect realistically. For one thing, Qt 4 has been released and it does 
not use exceptions. So KDE Library code will probably follow suit.

That's why KDE libraries are compiled with -fno-exceptions. And, as I said 
before, specific libraries and applications can turn exceptions back on, 
if they so need it.

But let me repeat: all exceptions must be caught before KDELibs/Qt code is 
run.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

5. Swa he géanhwearf tó timbran, and hwonne he cóm, lá! Unix cwæð "Hello, 
World". Ǽfre ǽghwilc wæs glæd and seo woruld wæs fréo.

[Attachment #5 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


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

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