[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNUnet-developers] [Update] Coding style clang-format
From: |
Schanzenbach, Martin |
Subject: |
Re: [GNUnet-developers] [Update] Coding style clang-format |
Date: |
Wed, 17 Apr 2019 13:05:34 +0200 |
Hi,
after playing with clang-format a bit, it seems that our current coding style
is now _mostly_ compatible.
There are to (minor) exceptions:
1. Always break function parameters
There is not configure options to always break function parameters, e.g.
f (x,
y,
z);
Parameters are either all in one line
f(x,y,z)
if it fits or all are in their own line
f(x,
y,
z)
Currently, in the code we have a subjective choice on when to do that.
2. Odd formatting with yoda style conditionals:
Example with yoda:
GNUNET_assert (
GNUNET_YES ==
GNUNET_CONTAINER_multipeermap_remove (dv_routes, &dv->target, dv));
without:
GNUNET_assert (GNUNET_CONTAINER_multipeermap_remove (dv_routes,
&dv->target,
dv) == GNUNET_YES);
Given that modern compilers (e.g. also GCC) give a warning (with -Wall) when
you put an assignment in a condition statement, maybe we don't need to put this
in the style anymore?
Readability would be the primary benefit, correct formatting secondary.
Opinions?
> On 16. Apr 2019, at 11:32, Schanzenbach, Martin <address@hidden> wrote:
>
> Signed PGP part
> Updated the format file with all your propsals. Now needs a clang-format
> which at least includes this commit:
> https://github.com/llvm-mirror/clang/commit/c4515d09740be87226d185f7728893d26c5af652
>
> i.e. > clang 8.0.0; let's hope they release soon (tm)
>
>> On 16. Apr 2019, at 11:17, Schanzenbach, Martin <address@hidden> wrote:
>>
>> Signed PGP part
>>
>>
>>> On 16. Apr 2019, at 10:54, Christian Grothoff <address@hidden> wrote:
>>>
>>> Signed PGP part
>>> On 4/16/19 10:48 AM, Schanzenbach, Martin wrote:
>>>> I added your changes with two notes:
>>>>
>>>> 1. SpaceAfterLogicalNot: true => This option does not seems to exist
>>>> (anymore?)
>>>
>>> That's a pity. I think this is a nice way to emphasize the not.
>>
>> I checked. It has been added recently. You need clang-format > 8.0.0 (i.e.
>> currently git HEAD)
>>
>>>
>>>> 2. AllowAllParametersOfDeclarationOnNextLine: false # CG: documentation
>>>> has AllowAllArgumentsOfDeclarationsOnNextLine! => I don't know what you
>>>> mean by this.
>>>
>>> It means that the Web manual I was reading had an option with
>>> "Arguments" in the name, while your file had "Parameters", so I don't
>>> know what it should be, or whether the docs I'm reading matched what the
>>> option does.
>>
>> Ah. Probably a typo in the docs.
>>
>>>
>>>
>>>
>>
>>
>>
>
>
>
signature.asc
Description: Message signed with OpenPGP
- [GNUnet-developers] Coding style clang-format, Schanzenbach, Martin, 2019/04/15
- Re: [GNUnet-developers] Coding style clang-format, Hartmut Goebel, 2019/04/15
- Re: [GNUnet-developers] Coding style clang-format, Florian Dold, 2019/04/15
- Re: [GNUnet-developers] Coding style clang-format, Schanzenbach, Martin, 2019/04/16
- Re: [GNUnet-developers] Coding style clang-format, Christian Grothoff, 2019/04/16
- Re: [GNUnet-developers] Coding style clang-format, Schanzenbach, Martin, 2019/04/16
- Re: [GNUnet-developers] Coding style clang-format, Schanzenbach, Martin, 2019/04/16
- Re: [GNUnet-developers] [Update] Coding style clang-format,
Schanzenbach, Martin <=
Re: [GNUnet-developers] Coding style clang-format, Schanzenbach, Martin, 2019/04/15