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

List:       kde-devel
Subject:    Re: qt-exceptions -> performance improvements
From:       Michael Matz <matzmich () cs ! tu-berlin ! de>
Date:       2000-10-13 1:18:05
[Download RAW message or body]

Hi,

On Fri, 13 Oct 2000, Dirk Mueller wrote:
> > and if an exception is thrown/occurs in a QObject.. or in a slot or
> > signal... 
> 
> Then you're dead anyway, because Qt never catches any exceptions. 

Nope, the below example works just fine with a Qt with -fexceptions. A Qt
without exceptions would probably SEGV or simply don't work, because the
exception thrown in the slot doesn't get propagated through
activate_signal() from which it is called. If khtml doesn't use such
things, then fine, but others might want to, so a libqt compiled with
-fno-exceptions is not a good idea.

> > If the gcc people would implement more efficient exception handling, 
> 
> I don't believe that the gcc team will do anything significant to improve
> their C++ support. :(

Huh? What do you mean here?

> > stop using the old setjmp/longjmp methods...
> 
> huh? whats wrong with them?

They are slow. But anyway gcc on linux doesn't use these old mechanisms to
implement exceptions, and all other platforms using ELF also wouldn't need
to (hello FreeBSD alex ;)


Ciao,
Michael.

---- exctest.h ----
#ifndef __exctest_h_included__
#define __exctest_h_included__
#include <qobject.h>
 
class MyObject : public QObject {
  Q_OBJECT
public:
  MyObject() : QObject() {}
  void doit();
signals:
  void mysignal();
public slots:
  void myslot();
};
#endif

---- exctest.cpp ----
#include <qglobal.h>
#include "exctest.h"
#include "exctest.moc"
 
void MyObject::doit()
{
  try { emit mysignal(); }
  catch (int i) { qDebug ("catched value %d\n", i); }
}
 
void MyObject::myslot()
{ qDebug("slot called\n"); throw (3); }
 
int main()
{
  MyObject *m1 = new MyObject;
  QObject::connect(m1, SIGNAL(mysignal()), m1, SLOT(myslot()) );
  m1->doit();
  delete m1;
  return 0;
}

 
>> Visit http://master.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