[Interest] Is moc obsolete?

Konstantin Tokarev annulen at yandex.ru
Wed Jul 8 20:56:42 CEST 2015



08.07.2015, 21:26, "Till Oliver Knoll" <till.oliver.knoll at gmail.com>:
>>  Am 08.07.2015 um 08:57 schrieb Igor Mironchik <igor.mironchik at gmail.com>:
>>
>>  Hi,
>>
>>  Does anybody know if Qt plans to remove moc in the future releases, let's say in Qt 6?
>
> What's wrong with moc? :)
>
> Seriously, while in the very beginning I was doubtful about an "additional build step that messes around with my source" moc never got into my way. Even with Visual Studio 6 and the corresponding Qt VS Addon back in the days one hardly noticed the presence of moc.
>
> And all moc does is spit out some more C++ code, which - most importantly for me - I never get to see! So why would I care about moc?
>
> Granted, initially moc did not take #defines and #ifdefs (mostly evil anyway) into account (IIRC moc now does some pre-processing on its own, or runs after the preprocess phase...), linker errors due to stale moc_* files occured (mostly due to different time stamps on network shares - "Try to compile in a minute! It'll work!") or "DLL export" issues then and when ("you need to DLL export the whole class that is going to be moc'ed - not just selected public/protected methods/symbols").
>
> But from a practical standpoint - especially in combination with qmake/Qt Creator - IMHO moc does its job well: create a "meta system, signal/slot connections etc."
>
> Or did I miss something?

It does not support many C++ features:

http://www.copperspice.com/docs/cs_overview/moc_limits.html

However, in clang-based moc it would be possible to support all of this stuff



-- 
Regards,
Konstantin



More information about the Interest mailing list