|
|
|
|
|
by sho_hn
1175 days ago
|
|
There's a lot of overstated FUD about the moc. It's a preprocessor that expands a few macro strings into relatively simple boilerplate C++. Yes, it's a separate little preprocessor binary instead of using C++'s built-in macro system, but the concept itself is not foreign to C++. The macro incantations aren't massively complicated and mostly are simple labels placed in header files; body code rarely uses anything moc-related these days. Compared to the crazy stuff Microsoft has done over the years within and on top of C++ on their platform, Qt's moc is barely a footnote. I respect not liking it, and I totally get the appeal of doing the same thing with tools built directly into the language (which to this day aren't fully comparable, and are mostly recent - check into the verdigris project for a solid and interesting take on attempting this), but it's a reasonably straight-forward approach to the problems it solves. |
|
It does have it's drawbacks. The MOC heavily penalizes build times, and build caching tools like ccache don't work out of the box with it. So not only does the MOC worsens builds, it also prevents basic optimizations from mitigating it.
> Compared to the crazy stuff Microsoft has done over the years (...)
Microsoft did a fantastic job with it's GUI frameworks. WPF is a stellar example of getting most things right. It's astounding how views are so trivial with WPF. XAML voodoo has it's critics but no one praising Qt would ever dare point a finger at XAML.