Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Without moc their is no signal slots and the handy stuff you get from plopping Q_OBJECT in your derived classes. So it's not going anywhere.


Can't they figure out a way to do that in pure c++ yet? In other words why does C++ lack reflection, and only seems to have a half baked RTTI? Perhaps the QT guys and other c++ application programmers didn't lobby C++ standards committee strongly enough for that?


Sure, but there's 1) a performance hit because things that can be done at compile-time currently, have to be done at runtime, and 2) syntactically verbose/cumbersome. They've decided that these things are not worth it to most people.

Besides, it still is C++: you can totally compile everything without the moc (although its probably not very useful to do so), since the extra keywords are just #defines.

I've personally never had any issues with the moc (but I did only ever use QtCreator/qmake, so...)


There is a possibility, but at the cost of uglier macros (since no reflection): https://woboq.com/blog/verdigris-qt-without-moc.html


There can't be reflection. C++ is compiled into machine code, it's a one way process.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: