I'm porting VC++7 codebase to VC++9. Surprisingly Visual Studio 2008 highlights internal as a keyword in C++ code but looks like it is not really treated as such.
What is this - a bug in VS, an environment setting I haven't found yet, or a sign that I will no longer be allowed to use internal as a regular identifier in some upcoming version? What's my best move in this situation?
I am not sure but I think internal specifier can be used in C++/CLI projects. So, since there is only a difference of one project setting between a non C++/CLI project and a C++/CLI Project, therefore, it might be that it is being highlighted because of this reason.
[Edit] Just checked, internal IS a keyword in C++/CLI and generates similar IL to the one generated by a C# project. So, my original thinking seems right. It seems to be a one parser for all flavors of C++ from Microsoft.
Just ignore it. The "problem" is just that not all parts of Visual Studio properly distinguish between C++ and C++/CLI. So certain C++/CLI keywords get highlighted even in plain native C++. (array
is another one).
This only affects syntax highlighting, not the actual compiler.
So the only reason to avoid these words is if you 1) find the bad syntax highlighting too annoying, or 2) plan on porting your application to C++/CLI.
The problem is that the parser used for highlighting is not one of the real C++ parsers. "One of", because VC++, C++/Za and C++/CLI are three dialects with different parsers. The VS pretty printer uses a common parser that doesn't always get it right. E.g. it has a single set of keywords, so it always assumes "internal" is a keyword.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With