[Interest] Is moc obsolete?

Philippe philwave at gmail.com
Wed Jul 8 21:22:03 CEST 2015


> 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."

Completely on the same line.
"Code Generators are Good", as quoted there:
http://doc.qt.io/qt-5/why-moc.html

Philippe





More information about the Interest mailing list