Yes, but adding a keyword that could be already in use as an identifier is fraught, and could become an obstacle. An alternative is to construct a sequence of punctuation tokens that cannot currently appear in a program, as was done for spaceship; with that in mind, you might propose something like `<~< x`?
I also thought of `&< x` lately, which looks a bit like shell redirection. I am not thrilled by this, `reloc x` conveys more meaning and stands out more IMO.
C++11 managed to do the migration of `auto` quite well, with compilers giving warnings beforehand. The same could happen with `reloc`. Migrating the codebase to a new version of the language always involves some work.
`auto` was already a keyword, though.
Migrating to C++11 caused some trouble I recall, mainly because we wanted to migrate from boost smart pointers to those of the STL.
I quickly looked at:
- my personal projects and those of Stormshield, `reloc` is never used at all.
- llvm has less than a hundred hits where `reloc` is used outside comments
and strings (counting uses, not variable declaration), and reloc is never used
to name a type, only variables.They mostly come from the ELF module.
- FreeBSD. It's mainly C but also has some contribs in C++. We could argue that if reloc is not seen in a C codebase, chances are it is not used that much as well in C++. It has a bit more than a hundred hits. They mostly come from llvm (FreeBSD has less than a dozen hits if we exclude llvm from the count, and they equally come from C and C++ contribs.)
This is just a quick search, but it gives us a hint that reloc might not be used that often.
Anyway, I think I am going to propose both alternatives, while pondering in favor of `reloc`.
Yes, that matches my own research; `reloc` is mostly used as an identifier in ELF code. So it might be possible to use it, but it would still have some cost.
It's still a problem if `reloc` is used as only as a variable identifer; are `reloc (x)`, `reloc + a` ill-formed relocation expressions or are they function call, arithmetic expressions? Is `reloc x.y` an ill-formed relocation expression or an expression missing an operator? I don't think having a token that means a keyword only when followed by an identifier is likely to be accepted.