Closed MHCooke closed 1 year ago
Clang Format supports a selection styles by default, they have been grouped by brace placement:
In-line:
New line:
Functions/Classes/Structs new line, rest inline:
Purely out of personal preference, I would like one from the in-line group. All these coding styles implement a max line length of 80 characters, which I propose increasing to 100 or 120.
The in-line formats all inherit from the google code style, with their own variations. Google style has one main oddity, they put a trailing underscore after class attributes/data members (but not in structs)
See this handy repo for the difference between each major style: https://github.com/motine/cppstylelineup
My preference would also be one from the in-line group as I like the compactness. I like the LLVM style the most, it has no major sins, and I like it's enum choice best, but I'm open to other options.
LLVM is decent but I have two issues with it, which we might be able to fix:
preference to omit braces around single line control flow
and whatever this is:
Cowboy::Cowboy()
: Age(45), GunCount(2) {
std::cout << "I am alive!" << std::endl;
}
GNU is my personal favourite but if we're going for one in the in-line group I would go for LLVM. Also I don't mind omitting braces for single line control flow, and those Field initialisations I don't hate but would probably just keep on the first line.
I'm happy with LLVM.
As a developer, I want to keep all the code looking consistent so that I can read other developers code more easily.