From kde-devel Wed Dec 07 20:38:30 2005 From: Volker Lukas Date: Wed, 07 Dec 2005 20:38:30 +0000 To: kde-devel Subject: Re: C++ exceptions Message-Id: X-MARC-Message: https://marc.info/?l=kde-devel&m=113398815818770 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 <<