Good naming convention for private member functions in C++?

Kiril Kirov picture Kiril Kirov · Aug 20, 2012 · Viewed 16.5k times · Source

For members, I use

//.......vv
SomeType m_XXX;
//.......^^

I'd love to use _ as a prefix for member functions, but names starting with _ or __ are reserved and should not be used.

My idea is, that when I have:

SomeClass myObject;
myObject.[XXX]

when the user (of the lib) write the dot (.), to see all functions (one after another) that are only public.

Is there a common naming convention for this?

I know, that I can use pImpl or inheritance, with interface and implementation classes

Answer

Tony Delroy picture Tony Delroy · Aug 20, 2012

The most common practice is to name member functions without any common prefix or suffix. Personally, I see no benefit in differentiating them, and if your motivation relates to "write the dot (.), to see all functions" then it sounds like you should configure or change your editor, rather than change your programming style to suit it.