> Also added const as it may as well include type modifiers.

Actually for C++ these are all reserved 
[keywords](https://en.cppreference.com/w/cpp/keyword), so should be in the 
primary list with the other keywords.

If you are going to include qualifiers then it should include `volatile` 
`constinit` `constexpr` `constexpr` `mutable`, and what about `alignas` 
(`_Alignas` in C).

But `const` and several of those can also be used in non-CV qualification 
context as well[^1], so since Scintilla can't detect context they will be 
wrongly coloured in one context or the other.  Only treating them as a keyword 
is context free and fits the Scintilla model.

So separating some keywords from others is not the right thing to do for C++, 
so this PR should not happen.

Might be ok for C since it tends not to re-use keywords in more than one 
context, but C23 adds a lot more built-in types, 
[see](https://en.cppreference.com/w/c/keyword) but again they are keywords.

[^1]: C++ has a tendency to re-use keywords in other contexts rather than 
defining new keywords that might clash with valid 
names in existing code.  So over time many keywords are becoming more than one 
thing (not to mention words that are 
keywords only in contexts where user names are illegal, eg `override` in:

      ```
      struct S {
        int override;
        virtual int foo() = 0;
      };

      struct DS : public S {
        int foo() override { override = 1; return 2; }
      };
      ```
      Geany shows all cases of `override` as keyword, but VScode shows only the 
`override` after `foo()` as a keyword, and the      others as member variables. 
 Thats something the current Geany/uctags/Scintilla combination can't handle).

      And C++ avoids using the ugly `_Caps` that C does.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3448#issuecomment-1504403557
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3448/[email protected]>

Reply via email to