Thursday, 5 September 2013

Is _ (single underscore) a valid C++ variable name?

Is _ (single underscore) a valid C++ variable name?

With gcc 4.7.2 this compiles just fine for me:
int main()
{
int _ = 1;
return 0;
}
Can I expect this to compile in general? I've read the answers about
underscores as prefixes. But what if the underscore isn't prefixing
anything?

No comments:

Post a Comment