What are the rules about using an underscore in a C++ identifier?

It’s common in C++ to name member variables with some kind of prefix to denote the fact that they’re member variables, rather than local variables or parameters. If you’ve come from an MFC background, you’ll probably use m_foo. I’ve also seen myFoo occasionally.

C# (or possibly just .NET) seems to recommend using just an underscore, as in _foo. Is this allowed by the C++ standard?

5 s
5

Leave a Comment