-3
Hello, I’m learning C++, and I’m looking for best practices for creating variables, functions, classes and so on. I’ve researched the subject on the Internet, but I couldn’t find anything to talk about directly, or when I talked about it was a subject of a certain old point, which was probably obsolete (I believe), however I went to read codes in C++ to try to understand how the style of the language is, but I realized that this is very varied, as for example the variable int windows_size
can also be written as int windowsSize
, or the function int get_windows_size()
(excessive use of "_" to give "space" makes me think that this style of programming comes from C) to be written as int GetWindowsSize()
or even int getWindowsSize()
and this further increased my uncertainty about how to program (or try) within the language patterns, so I come here to ask what the correct C++ coding pattern is, from now on, I thank everyone who answers
Depending on who program, the default library tends to follow snake_case.
– Maniero
I see snake_case a lot in various codes, I believe it is the most adopted by C programmers++
– Luiz Fernando
I’ve been researching in English and found a document from Google that says the style of code she uses in her projects, I believe I will follow the style too, I found it very useful and concise in my opinion, the link from it
– Luiz Fernando
I like to use the Camelcase java.
– user201641
If there was a pattern, tools like Clang-Tidy would be obsolete. Ideally, it is constant, the rules themselves are not important.
– aviana