Re: [RFC] clang-format: outline the git project's coding style
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 8, 2017, 18:25 UTC
- Message-ID
- <xmqqy3qtc3x4.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170808180317.GA73298@google.com>
Brandon Williams <bmwill@google.com> writes:
Show 17 quoted lines
>> > +# Add a line break after the return type of top-level functions >> > +# int >> > +# foo(); >> > +AlwaysBreakAfterReturnType: TopLevel >> >> We do that? > > Haha So generally no we don't do this. Though there are definitely many > places in our code base where we do. Personally this makes it a bit > easier to read when you end up having long function names. I also > worked on a code base which did this and it made it incredible easy to > grep for the definition of a function. If you grep for 'foo()' then > you'd get all the uses of the function including the definition but if > you grep for '^foo()' you'd get only the definition. > > But that's my preference, if we end up using this tool it would probably > make sense to change this.
Yeah, I even know people who did
int foo(void)
for greppability of "^foo". It took some effort to get used to that style.
Show 8 quoted lines
>> > +# Insert a space after a cast >> > +# x = (int32) y; not x = (int32)y; >> > +SpaceAfterCStyleCast: true >> >> Hmph, I thought we did the latter, i.e. cast sticks to the casted >> expression without SP. > > I've seen both and I wasn't sure which was the correct form to use.
We do the latter because checkpatch.pl from the kernel project tells us to, I think.