[Aptitude-devel] 002-qt-stubs review

Sune Vuorela nospam at vuorela.dk
Tue Jul 13 08:37:18 UTC 2010


On 2010-07-12, Daniel Burrows <dburrows at google.com> wrote:
>   Wow, apparently Qt #defines the word "emit".  That's kind of horrifying.
> I guess it's the heritage of having started out as a hacky preprocessor
> on top of an antique dialect of C++ from circa 1996...
>
>   I think that the only really robust way to handle this is to declare by
> fiat that <sigc++/sigc++.h> has to be included at the top of every
> .cc file under qt/ that needs sigc++ or references a header that
> needs sigc++.
>
>   *NOTE THAT THIS MEANS THAT THE QT HEADERS WILL NOT BE
> SELF-CONTAINED.*  This is pretty horrible, but putting sigc++ includes
> in the headers will mean we have to worry about header-to-header
> includes when figuring out a safe order.
>
>   Now please pardon me while I go scoop my eyes out with a rusty
> spoon...

#ifndef Q_MOC_RUN
# if defined(QT_NO_KEYWORDS)
#  define QT_NO_EMIT
# else
#   define slots
#   define signals protected
# endif
# define Q_SLOTS
# define Q_SIGNALS protected
# define Q_PRIVATE_SLOT(d, signature)
# define Q_EMIT
#ifndef QT_NO_EMIT
# define emit
#endif

is the exact preprocessor macro going on here. And with QT_NO_KEYWORDS,
only the Q_FOO versions can be used.

/Sune




More information about the Aptitude-devel mailing list