r184894 - Formatter: Don't put a space after parameter-naming block comments.

Tobias Grosser tobias at grosser.es
Fri Jun 28 09:31:00 PDT 2013


On 06/28/2013 05:37 AM, Alexander Kornienko wrote:
> On Fri, Jun 28, 2013 at 2:29 PM, Alexander Kornienko <alexfh at google.com>wrote:
>
>> What is the reason for this? I've not found any related rules in the
>> coding styles we support (llvm, google, chromium, linux kernel).
>>
>>
>> On Wed, Jun 26, 2013 at 2:15 AM, Nico Weber <nicolasweber at gmx.de> wrote:
>>
>>> Author: nico
>>> Date: Tue Jun 25 19:15:19 2013
>>> New Revision: 184894
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=184894&view=rev
>>> Log:
>>> Formatter: Don't put a space after parameter-naming block comments.
>>>
>>> Before: f(a, b, /*doFoo=*/ false);
>>> Now: f(a, b, /*doFoo=*/false);
>>>
>>> This style is a lot more common:
>>> $ ack -H '=\*\/\w' lib | wc -l
>>>      1281
>>> $ ack -H '=\*\/ \w' lib | wc -l
>>>        70
>>>
>>
> Clarification: I see your research, but I'm personally not convinced that
> this is a better style, and that it's worth special casing it.

There is a golden rule mentioned in the LLVM coding standard's 
introduction stating:

"If you are extending, enhancing, or bug fixing already implemented 
code, use the style that is already being used so that the source is 
uniform and easy to follow."

So the LLVM style of clang-format should in my opinion always default to 
what the common practice in the code we have today is.

I can see that there may be valid reasons to prefer a different style,
but the right way to change/improve the LLVM style is probably to start 
a discussion on the LLVM mailing lists to update the LLVM style guide. 
Changing clang-format to implement an improve LLVM style that is not 
documented anywhere does not seem to be the way to go.

Cheers,
Tobias



More information about the cfe-commits mailing list