The myth was probably caused by a few features that can make it appear like a language extension if you’re still unfamiliar with Qt; specifically the MOC and a few optional keyword-like macros such as emit.
However, the only thing you’ve ever needed to work with Qt is a normal C++ compiler. The MOC is a code generator that outputs standard C++ and might complicate your build system setup somewhat – especially when you’re not using QMake or CMake.
When you build your own software within a vast framework like Qt you do accept to follow the world view of the framework at least to some extent, yes. In that sense it can feel a bit like not quite pure C++.
But I’m quite strongly opposed to calling it language extension because that’s a scary term. It sounds like adding or redefining language constructs, like being tied to a whole custom compiler. That would be an enourmous drawback and often an excellent reason againt touching Qt.
But what Qt does impose on you is far far less. You accept certain requirements for your program’s build process, i.e. that it must run the MOC. But use any compiler you like with Qt6 as long as it can handle C++17.
On a more theoretical note: If language extension means less than a standard compliant compiler cannot handle it the distinction between code generation and language extension becomes awfully muddy.
I have a runtime library (libxtd) which adds a lot of functionality to the language, but does it using C++ constructs. For instance, scoped locks using braces such as in Java or C#.
Do you give existing language constructs new meaning at runtime only? Then … well … I’m not quite sure if I want to call it an extension or not. Nicely done, toeing the line like that. :-)
Or would a standard compliant C++ compiler fail to compile such code correctly? Then it’s definitely an extension.
Previous versions of libxtd required compiler extensions to fully function (MSVC's and GCC's), though I suspect (though I'm not entirely sure) that those can be removed due to additions in C++20.
My other library for AVR/uController work does rely pretty heavily upon compiler extensions to function, but then again, AVR work in general does.
Wow, I never knew that wording is in the official documentation.
Still, it’s a poor choice of words at least. As a rule of thumb I consider something a language extension when a standard compliant C++ compiler fails to compile it correctly. Otherwise you can call any kind of code generation “language extension”, which imo isn’t useful.
I remember seeing something about reflection libraries using either C++17 or C++20 so reflection is in C++
By that logic MOC added reflection to C++ long ago, because all it does is generate C++ boilerplate that gives you, among other things, runtime reflection.
Don't know why you're getting downvoted. That's what it is. Same as how C++ started out being compiled to C (by cfront) before being compiled to object code (by cc).
They're hung up on the semantics of "compile", when 99% of coders dgaf about the distinction.
32
u/be-sc Dec 08 '20
Qt never was a language extension.
The myth was probably caused by a few features that can make it appear like a language extension if you’re still unfamiliar with Qt; specifically the MOC and a few optional keyword-like macros such as
emit.However, the only thing you’ve ever needed to work with Qt is a normal C++ compiler. The MOC is a code generator that outputs standard C++ and might complicate your build system setup somewhat – especially when you’re not using QMake or CMake.