C++ naming: read_input() vs. readInput()

c++, naming-conventions

Solution

This is all very subjective, but generally for C++ I do:

`camelCase` for functions and variables.

`PascalCase` for classes.

public:
protected:
private:

In classes.

Edit: Forgot these 2:

Yes, `friend` at the end, `typedef` either at the beginning if they are used in the class, or after if they use the class (for obvious reasons).

Problem

Which naming convention is more preferable in C++? The underscore method or the camelCase method? I have coded in Java for a while and I am used to the camelCase naming conventions. Which one is more prevalent? Also, while defining a class, is there any preferred ordering of private/public/protected variables/methods? Are friends usually put in the end? What about typedefs, do they come at the top of the class definition?

Original source

Related problems