[Development] Qt Coding Guidelines
marc.mutz at kdab.com
Sat Mar 19 01:31:12 CET 2016
On Friday 18 March 2016 23:45:22 Marc Mutz wrote:
> On Friday 18 March 2016 17:05:37 Knoll Lars wrote:
> > On 18/03/16 16:03, "Development on behalf of Marc Mutz" <development-
> bounces+lars.knoll=theqtcompany.com at qt-project.org on behalf of
> marc.mutz at kdab.com> wrote:
> > >On Friday 18 March 2016 15:37:40 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.
> > >
> > >Amen.
> > Fully agree as well. So how do we get to some tool that we can use for
> > the purpose?
> Let's start with Morton's config file and ask people to use
> git-clang-format before submitting?
To counter objections raised in PM: Of course, this would be an as-if rule: if
you manually format your code the way clang-format would had you run it,
there's no point in actually running it.
As for keeping clang around: moc, qdoc and QtC are being ported to clang. At
some point, it will be a build requirement, and possibly bundled with Qt
(shudder), so it will not be an additional dependency.
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
KDAB - The Qt Experts
More information about the Development