Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Some C++ Keyword Not Detected
QtWS25 Last Chance

Some C++ Keyword Not Detected

Scheduled Pinned Locked Moved Qt Creator and other tools
10 Posts 3 Posters 4.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bijanbina
    wrote on 19 Jun 2011, 06:15 last edited by
    #1

    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!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 19 Jun 2011, 08:22 last edited by
      #2

      I suggest you file a bugreport in "Jira":http://bugreports.qt.nokia.com on this.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bijanbina
        wrote on 19 Jun 2011, 10:26 last edited by
        #3

        ok file it on Jira you can find it "here":http://bugreports.qt.nokia.com/browse/QTCREATORBUG-5169

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on 19 Jun 2011, 11:48 last edited by
          #4

          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.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bijanbina
            wrote on 19 Jun 2011, 12:39 last edited by
            #5

            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!

            1 Reply Last reply
            0
            • L Offline
              L Offline
              loladiro
              wrote on 19 Jun 2011, 12:43 last edited by
              #6

              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)

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bijanbina
                wrote on 19 Jun 2011, 12:57 last edited by
                #7

                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

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  loladiro
                  wrote on 19 Jun 2011, 13:43 last edited by
                  #8

                  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):
                  [quote]
                  The identifiers 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
                  alignof
                  asm
                  auto
                  bool
                  break
                  case
                  catch
                  char
                  char16_t
                  char32_t
                  class
                  const
                  constexpr
                  const_cast
                  continue
                  decltype
                  default
                  delete
                  do
                  double
                  dynamic_cast
                  else
                  enum
                  explicit
                  export
                  extern
                  false
                  float
                  for
                  friend
                  goto
                  if
                  inline
                  int
                  long
                  mutable
                  namespace
                  new
                  noexcept
                  nullptr
                  operator
                  private
                  protected
                  public
                  register
                  reinterpret_cast
                  return
                  short
                  signed
                  sizeof
                  static
                  static_assert
                  static_cast
                  struct
                  switch
                  template
                  this
                  thread_local
                  throw
                  true
                  try
                  typedef
                  typeid
                  typename
                  union
                  unsigned
                  using
                  virtual
                  void
                  volatile
                  wchar_t
                  while
                  [/quote]
                  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)

                  [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:
                  preprocessing-op-or-punc: one
                  {
                  }
                  [
                  <:
                  :>
                  <%
                  new delete
                  ?
                  +

                  !

                  <
                  ˆ=
                  &=
                  |=
                  <=

                  =
                  &&
                  and and_eq
                  bitand
                  or
                  or_eq
                  xor
                  of
                  ]
                  %>
                  ::
                  /

                  <<
                  ||
                  bitor
                  xor_eq

                  %:
                  .
                  %
                  +=

                  ++
                  compl

                  %:%:
                  .*
                  ˆ
                  -=

                  =
                  --
                  not
                  (
                  ;
                  )
                  :
                  &
                  =
                  <<=
                  ,
                  not_eq
                  |
                  /=
                  ==
                  ->

                  ...
                  ∼
                  %=
                  !=
                  ->
                  [/quote]

                  [quote]
                  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
                  and
                  not_eq
                  and_eq
                  or
                  bitand
                  or_eq
                  bitor
                  xor
                  compl
                  xor_eq
                  not
                  [/quote]

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    bijanbina
                    wrote on 19 Jun 2011, 14:15 last edited by
                    #9

                    can you link your reference

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      loladiro
                      wrote on 19 Jun 2011, 14:25 last edited by
                      #10

                      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)

                      1 Reply Last reply
                      0

                      1/10

                      19 Jun 2011, 06:15

                      • Login

                      • Login or register to search.
                      1 out of 10
                      • First post
                        1/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved