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

List:       kde-devel
Subject:    Re: C++ exceptions
From:       Volker Lukas <vlukas () gmx ! de>
Date:       2005-12-07 20:38:30
Message-ID: dn7h5b$ffp$1 () sea ! gmane ! org
[Download RAW message or body]

Thiago Macieira wrote:

> Volker Lukas wrote:
>>Thiago Macieira wrote:
>>> [...]
>>> So you can expect people to compile it with -fno-exceptions. If you
>>> write applications that rely on exceptions being enabled in Qt, you'll
>>> be shooting yourself in the foot. Don't do that.
>>
>>No. The user who disables it is a fault here. Exception support is
>> needed for *correct* programs to be executed *correctly*. If the user
>> willfully asks the compiler to produce incorrect output, he has to live
>> with the outcome. He can not just assume that nobody uses exceptions in
>> conjunction with Qt.
> 
> Hmm... I think you misunderstood again: 
I do not have that impression. To be clear, I am talking about situations
like the following:
-----------
class my_widget : public QWidget
{
virtual void paintEvent(QPaintEvent*)
 { ... throw something(); ... }
};
----------


> [...]
> 
> The point is that Qt doesn't require exceptions to work and the configure
> script explicitly tells the users that they can safely turn exceptions
> off.
It does seem to indicate that, yes. But first, the wording states a degree
of uncertainty ("applications *should* continue to work"). Second, the
message might well be understood that support for exceptions is disabled
only for parts of Qt which do not require that support (i.e. code
surrounding event-handlers/slots is exempt). Third, no other part of the Qt
documentation I know of does state that one can not expect exceptions to
work, while some ressources actually do claim that they will work (for
example messages of Trolltech employees on the Qt mailing list). Just to
cite one instance where it is suggested to use exceptions there is an
article of Scott Collins:
http://scottcollins.net/blog/2005/07/i-love-c-exceptions.html
Why should Trolltech employ a guy writing about Qt when he would advise
people of bad practices when using it?
(I know that the article does not state specifically that throwing
exceptions in event-handlers/slots is good, it is just that there is an
overall tendency suggesting that Qt will not pose problems.)

Even when one thinks that the mentioned message of the configure script is
an authoritative statement, saying that using exceptions in
event-handlers/slots is not allowed, a more prominent message would be in
order. (On common terminals, one does not even see that message because it
scrolled out of the viewport.)



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