Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Some C++ Keyword Not Detected
hi in "C++ Reference":http://www.cppreference.com/wiki/keywords/start @and@ is c++ keyword but qt doesn't know it as c++ keyword!
how can i add it to qt c++ editor this keyword.
i also use "Generic highlight " but i find that it's not work for c++ and QML and it's just work for other language that qt not create an official engine for it!
andre last edited by
I suggest you file a bugreport in "Jira":http://bugreports.qt.nokia.com on this.
ok file it on Jira you can find it "here":http://bugreports.qt.nokia.com/browse/QTCREATORBUG-5169
The problem here is, that "and" is an alias for "&&" and is therefore highlighted just as the operator it stands for (in this case not at all). I think this is the correct behavior.
ok you are write the qt detect it as operator but Indeed and it's not an operator and it's a c++ keyword!
it's just a bug reason!
It is an operator. Using and would cause the operator&&() method to be called if overloaded. Every operator is also a keyword, but not every keyword is an operator.
EDIT: I probably used keyword incorrectly here, what I actually meant is closer to token (See my next post on the for the definition of keyword in the c++ standard)
no ! is + is a keyword?
and you can see all reference for this that say and is a keyword ! why you want to fight when all reference say the true
I'm sorry, I probably formulated that incorrectly. I think it's not our decision to make (we'll see what the Qt developers say). A little more information on what I base my opinion. From the standard (Section 2.12.1):
The identiﬁers shown in Table 3 are reserved for use as keywords (that is, they are unconditionally treated
as keywords in phase 7) except in an attribute-token (7.6.1) [ Note: The export keyword is unused but is
reserved for future use. — end note ]:
Table 3 — Keywords
In my opinion, even though the aliases are reserved and cannot be used as variable names, they should not be highlighted the same way as the ones that are explicitly called keywords, but rather like operators, as they behave and are used exactly as such:
As you can see in the following two exerts from the standard, the aliases are defined as operators (1st quote), even though it is noted in the keywords section, that they should be not used as variable names (2nd quote)
The lexical representation of C++ programs includes a number of preprocessing tokens which are used in
the syntax of the preprocessor or are converted into tokens for operators and punctuators:
Furthermore, the alternative representations shown in Table 4 for certain operators and punctuators (2.6)
are reserved and shall not be used otherwise:
Table 4 — Alternative representations
can you link your reference
I was referring to the ISO/IEC 14882 (C++ standard) available as direct download "here":http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3092.pdf or as a draft from February 2011 "here":http://open-std.org/JTC1/SC22/WG21/docs/papers/2011/n3242.pdf. You can find the project page (with other specifications) "here":http://open-std.org/JTC1/SC22/WG21/docs/projects#14882
EDIT: Warning! Big PDF files (10MB)