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

List:       kde-devel
Subject:    Re: C++ exceptions
From:       Vladimir Prus <ghost () cs ! msu ! su>
Date:       2005-12-05 16:52:07
Message-ID: dn1r7n$nuh$1 () sea ! gmane ! org
[Download RAW message or body]

Thiago Macieira wrote:

> Jonas Widarsson wrote:
>>I've learned that there is some kind of decision made for KDE to not use
>>exceptions.
> 
> No.
> 
> KDE libraries don't use exceptions unnecessarily. KDE programs are fully
> free to use them if they want.

But it's a bit hard to use them. Say, there's 30 KActions that are connected
to 30 slots. Each slot calls some other functions, and all of them might
throw. Since KAction is from kdelibs, it has no catch statements. So I
either have to:

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.

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.

- Volodya




 
>> 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