[Development] Qt Coding Guidelines

André Somers andre at familiesomers.nl
Fri Mar 18 19:01:09 CET 2016

Op 18/03/2016 om 18:54 schreef Allan Sandfeld Jensen:
> On Friday 18 March 2016, André Somers wrote:
>> Op 18/03/2016 om 09:24 schreef Rutledge Shawn:
>>> Forcing it on everyone that way will be controversial, because there
>>> is still some leeway in formatting, whereas automation would remove
>>> any chance of personal preference, and probably screw up in some
>>> cases.  But we could at least start by adding the clang-format config
>>> file to git so that it’s available for doing this manually.  Then in a
>>> few years maybe everybody will get used to it enough, and it can be
>>> refined enough, to become near-universal.
>> That's the point: remove the personal preference. Or, make it
>> irrelevant. You can format your own code localy on your own system
>> however you like. As soon as it gets integrated, it will formatted
>> following whatever the standard is anyway.
>> So no, I do not think there should be leeway for personal differences
>> here. Code formatting matters for readability, but it doesn't merrit
>> long discussions or wasting time fixing -1's because of wrongly placed
>> spaces. If the formatting needs improvement, improve the script doing
>> the work, don't do it manually.
> There isn't any single unique formatting that follows the rule.
Follows what rule?
> Please don't
> correct code that already follows existing rules, an automatic crappifier
> would not be a good thing.
If the rules for 5.8 would be "formatted using clang-format using LLVM 
formatting" (to give an example), existing code would not be following 
the rule and the output would be exactly what was mandated by the rule.
> And people should always edit in the final result, otherwise they can't pre-
> format the code, which means we only get automatically crappified formatting.
No, they should not. They should not need to nor want to, and they 
should not be bothered about it either. Even if the result is not as 
pretty as they think they can make it look, leave it. If you really feel 
the need to fix formatting for some case, fix the formatter, not the 
result. You may call it crappified formatting all you want, at least it 
is both consistent and something none of us would have to spend time on 
anymore caring about. You'll get used to it. Or not.


More information about the Development mailing list