C++ – Naming functions, methods, pointers, variables, arrays etc in C++

c++naming

Allright, doing some project with few friends, and I need some standard for naming things in c++. Does anyone have any good naming scheme for c++ that is well thought-out and not made in like 10min.

Example, int* house should be named int* house_p, so that when someone reads the code, he doesn't need to scroll all the time wondering if a thing is a pointer, array, matrix, or whatever…

Post your well thought-out naming schemes that you are using !

Best Solution

Example, int* house should be named int* house_p, so that when someone reads the code, he doesn't need to scroll all the time wondering if a thing is a pointer, array, matrix, or whatever...

But what if its type changes - are you going to go through all your code and change the names of all the variables. And what if the variable is an instance of a complex type:

ComplicatedDerivativeFinancialInstrument x;

What suffix will you use?

What you are asking about is known as Hungarian notation - its use in C++ is almost universally considered to be A Bad Idea.