Back to Blog home

Qt 4.1 rocks!

Published on Friday December 23, 2005 by Matthias Ettrich in Qt | Comments

The community reactions to the release of 4.1 were quite encouraging. If you followed some of the discussions, e.g. on http://osnews.com/comment.php?news_id=13042 , you have probably noticed that even the most verbal critics are finally running out of arguments. Basically the only complaint that's left is that Qt - fasten your seat belts - adds introspection to C++. And it does this by - fasten your seat belts tighter - defining three [sic!] macros: Q_SIGNALS, Q_SLOTS, and Q_EMIT (or for the more pragmatics among us: signals, slots, and emit). Muahuahua, evil Trolls, how dare we extending C/C++ for the benefit of programming? Are we too stupid to realize that C++ should not have introspection, that those who want introspection should use Java or a scripting language, or at the very least code their meta code by hand?

Ironically enough the complaint doesn't come from C or C++ programmers, those are quite used to macros. The complaint comes from people that prefer other languages, and consequently they dislike Qt for making the life of C++ programmers easier. We wrote Qt, we know it is not a "pure" C++ framework, just like C++ is not a "pure" language. Qt makes use of the C-subset of C++, including the preprocessor. And it makes very good use of it. What made C++ the most successful programming language on the planet is its pragmatic design, and its compatibility with C. It's a meta language, a language powerful enough to be extended to something as beautiful and easy to work with as Qt.

Seriously, we dislike having to use macros just as much as any other C++ programmers. I wish there was a standard C++ preprocessor that fit better into the language than cpp does, and that understood namespaces. However, if three macros are a big problem for you to trade against a wealth of features, than I really envy you: The rest of the world you live in must be really perfect.

The other thing that's funny about the whole debate is the fact that Qt - like any other successful real-world C/C++ framework that supports different platforms and compilers - defines many more macros than that. Prominent ones are Q_OBJECT, QT_VERSION, Q_OS_UNIX, Q_WS_X11, Q_DECL_DEPRECATED, Q_DECL_EXPORT, and watch guards around each headerfile like QOBJECT_H, QWIDGET_H, QPUSHBUTTON_H, and so on.

And for those that wonder what real abuse of macros is, have a look at http://cvsweb.xfree86.org/cvsweb/xc/include/X.h?rev=1.1.1.2

Can't wait until 4.2, and 4.3. There will come the point were the last ones not to use Qt will realize that they have bet on the wrong horse. Muahuahua.

Subscribe to Our Blog

Stay up to date with the latest marketing, sales and service tips and news.

The blog comment system has been migrated to a new platform. If you face any issues, please let us know via feedback@qt.io.