views:

284

answers:

3

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?

+7  A: 

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.

Aamir
I think not it is "one parser for all flavours of C", but some of the .NET mechanisms that was not in old C++ are introduced in C++ for .NET, and for obvious reasons, they are the same semantics as C#.
awe
+3  A: 

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.

MSalters
+1  A: 

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.

jalf